Skip to content

Commit adb3c21

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-58976
2 parents 5a312ac + 7003dff commit adb3c21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1084
-56
lines changed

app/code/Magento/Backend/etc/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<template>
1212
<minify_html>0</minify_html>
1313
</template>
14+
<static>
15+
<sign>1</sign>
16+
</static>
1417
</dev>
1518
<system>
1619
<media_storage_configuration>

app/code/Magento/CatalogInventory/Helper/Stock.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ public function addIsInStockFilterToCollection($collection)
154154
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
155155
);
156156
$resource = $this->getStockStatusResource();
157-
$resource->addStockDataToCollection($collection, !$isShowOutOfStock);
157+
$resource->addStockDataToCollection(
158+
$collection,
159+
!$isShowOutOfStock && $collection->getFlag('require_stock_items')
160+
);
158161
$collection->setFlag($stockFlag, true);
159162
}
160163
}

dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Store/Edit/Form/StoreForm.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ class StoreForm extends Form
2222
*/
2323
protected $store = '//option[contains(.,"%s")]';
2424

25+
/**
26+
* Store dropdown selector
27+
*
28+
* @var string
29+
*/
30+
protected $storeGroupId = '//select[@id="store_group_id"]';
31+
2532
/**
2633
* Check that Store visible in Store dropdown
2734
*
@@ -32,4 +39,16 @@ public function isStoreVisible($name)
3239
{
3340
return $this->_rootElement->find(sprintf($this->store, $name), Locator::SELECTOR_XPATH)->isVisible();
3441
}
42+
43+
/**
44+
* Select store view by name from dropdown
45+
*
46+
* @param string $name
47+
* @return bool
48+
*/
49+
public function selectStore($name)
50+
{
51+
return $this->_rootElement->find($this->storeGroupId, Locator::SELECTOR_XPATH, 'optgroupselect')
52+
->setValue($name);
53+
}
3554
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Cms\Test\Constraint;
8+
9+
use Magento\Cms\Test\Fixture\CmsPage;
10+
use Magento\Cms\Test\Page\CmsPage as FrontCmsPage;
11+
use Magento\Mtf\Client\BrowserInterface;
12+
use Magento\Mtf\Constraint\AbstractConstraint;
13+
14+
/**
15+
* Assert that created CMS page with expected contents displayed on Frontend.
16+
*/
17+
class AssertCmsPageOnFrontend extends AbstractConstraint
18+
{
19+
/**
20+
* Assert that created CMS page with expected contents displayed on Frontend.
21+
*
22+
* @param CmsPage $cms
23+
* @param FrontCmsPage $frontCmsPage,
24+
* @param BrowserInterface $browser
25+
* @param string $displayContent
26+
* @return void
27+
*/
28+
public function processAssert(
29+
CmsPage $cms,
30+
FrontCmsPage $frontCmsPage,
31+
BrowserInterface $browser,
32+
$displayContent = null
33+
) {
34+
$browser->open($_ENV['app_frontend_url'] . $cms->getIdentifier());
35+
$fixtureContent = $cms->getContent();
36+
\PHPUnit_Framework_Assert::assertContains(
37+
$displayContent != null ? $displayContent : $fixtureContent['content'],
38+
$frontCmsPage->getCmsPageBlock()->getPageContent(),
39+
'Wrong content is displayed.'
40+
);
41+
}
42+
43+
/**
44+
* CMS Page content equals to data from fixture.
45+
*
46+
* @return string
47+
*/
48+
public function toString()
49+
{
50+
return 'CMS Page content equals to data from fixture.';
51+
}
52+
}

dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ class AssertCmsPagePreview extends AbstractConstraint
3030
* @param FrontCmsPage $frontCmsPage
3131
* @param CmsPage $cms
3232
* @param BrowserInterface $browser
33+
* @param string $displayContent
3334
* @return void
3435
*/
3536
public function processAssert(
3637
CmsPageIndex $cmsIndex,
3738
FrontCmsIndex $frontCmsIndex,
3839
FrontCmsPage $frontCmsPage,
3940
CmsPage $cms,
40-
BrowserInterface $browser
41+
BrowserInterface $browser,
42+
$displayContent = null
4143
) {
4244
$cmsIndex->open();
4345
$filter = ['title' => $cms->getTitle()];
@@ -46,7 +48,7 @@ public function processAssert(
4648

4749
$fixtureContent = $cms->getContent();
4850
\PHPUnit_Framework_Assert::assertContains(
49-
$fixtureContent['content'],
51+
$displayContent != null ? $displayContent : $fixtureContent['content'],
5052
$frontCmsPage->getCmsPageBlock()->getPageContent(),
5153
'Wrong content is displayed.'
5254
);

dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,18 @@
5454
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" />
5555
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" />
5656
</variation>
57+
<variation name="CreateCmsPageEntityTestVariation5" summary="Block Cache Exploit" ticketId="MAGETWO-48017">
58+
<data name="tag" xsi:type="string">severity:S2</data>
59+
<data name="fixtureType" xsi:type="string">cmsPage</data>
60+
<data name="data/title" xsi:type="string">NewCmsPage%isolation%</data>
61+
<data name="data/identifier" xsi:type="string">identifier-%isolation%</data>
62+
<data name="data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data>
63+
<data name="data/is_active" xsi:type="string">Yes</data>
64+
<data name="data/content/content" xsi:type="string">\\{{block class=&apos;Magento\Framework\View\Element\Text&apos; text=&apos;bla bla bla&apos; cache_key=&apos;BACKEND_ACL_RESOURCES&apos; cache_lifetime=999\}}</data>
65+
<data name="displayContent" xsi:type="string">bla bla bla</data>
66+
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" />
67+
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" />
68+
<constraint name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend" />
69+
</variation>
5770
</testCase>
5871
</config>

dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,84 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9-
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage">
9+
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage">
1010
<arguments>
11-
<argument name="severity" xsi:type="string">high</argument>
11+
<argument name="severity" xsi:type="string">S1</argument>
1212
</arguments>
1313
</type>
14-
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage">
14+
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid">
15+
<arguments>
16+
<argument name="severity" xsi:type="string">S2</argument>
17+
</arguments>
18+
</type>
19+
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockNotInGrid">
1520
<arguments>
16-
<argument name="severity" xsi:type="string">high</argument>
21+
<argument name="severity" xsi:type="string">S3</argument>
1722
</arguments>
1823
</type>
1924
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage">
2025
<arguments>
21-
<argument name="severity" xsi:type="string">high</argument>
26+
<argument name="severity" xsi:type="string">S3</argument>
2227
</arguments>
2328
</type>
24-
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage">
29+
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage">
30+
<arguments>
31+
<argument name="severity" xsi:type="string">S1</argument>
32+
</arguments>
33+
</type>
34+
<type name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage">
35+
<arguments>
36+
<argument name="severity" xsi:type="string">S1</argument>
37+
</arguments>
38+
</type>
39+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageDeleteMessage">
40+
<arguments>
41+
<argument name="severity" xsi:type="string">S1</argument>
42+
</arguments>
43+
</type>
44+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend">
45+
<arguments>
46+
<argument name="severity" xsi:type="string">S2</argument>
47+
</arguments>
48+
</type>
49+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageDuplicateErrorMessage">
50+
<arguments>
51+
<argument name="severity" xsi:type="string">S1</argument>
52+
</arguments>
53+
</type>
54+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageForm">
55+
<arguments>
56+
<argument name="severity" xsi:type="string">S2</argument>
57+
</arguments>
58+
</type>
59+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid">
60+
<arguments>
61+
<argument name="severity" xsi:type="string">S2</argument>
62+
</arguments>
63+
</type>
64+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageNotInGrid">
65+
<arguments>
66+
<argument name="severity" xsi:type="string">S3</argument>
67+
</arguments>
68+
</type>
69+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageOnFrontend">
70+
<arguments>
71+
<argument name="severity" xsi:type="string">S1</argument>
72+
</arguments>
73+
</type>
74+
<type name="Magento\Cms\Test\Constraint\AssertCmsPagePreview">
75+
<arguments>
76+
<argument name="severity" xsi:type="string">S1</argument>
77+
</arguments>
78+
</type>
79+
<type name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage">
80+
<arguments>
81+
<argument name="severity" xsi:type="string">S1</argument>
82+
</arguments>
83+
</type>
84+
<type name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect">
2585
<arguments>
26-
<argument name="severity" xsi:type="string">high</argument>
86+
<argument name="severity" xsi:type="string">S1</argument>
2787
</arguments>
2888
</type>
2989
</config>

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,92 @@ public function getLastName()
110110
$mapping['lastname']['strategy']
111111
)->getValue();
112112
}
113+
114+
/**
115+
* Set 'Change Email' checkbox value.
116+
*
117+
* @param boolean $value
118+
* @return void
119+
*/
120+
public function setChangeEmail($value)
121+
{
122+
$mapping = $this->dataMapping();
123+
$this->_rootElement->find(
124+
$mapping['change_email']['selector'],
125+
$mapping['change_email']['strategy'],
126+
'checkbox'
127+
)->setValue($value ? "Yes" : "No");
128+
}
129+
130+
/**
131+
* Set 'Change Password' checkbox value.
132+
*
133+
* @param boolean $value
134+
* @return void
135+
*/
136+
public function setChangePassword($value)
137+
{
138+
$mapping = $this->dataMapping();
139+
$this->_rootElement->find(
140+
$mapping['change_password']['selector'],
141+
$mapping['change_password']['strategy'],
142+
'checkbox'
143+
)->setValue($value ? "Yes" : "No");
144+
}
145+
146+
/**
147+
* Check if Current Password field is visible.
148+
*
149+
* @return boolean
150+
*/
151+
public function isCurrentPasswordVisible()
152+
{
153+
$mapping = $this->dataMapping();
154+
return $this->_rootElement->find(
155+
$mapping['current_password']['selector'],
156+
$mapping['current_password']['strategy']
157+
)->isVisible();
158+
}
159+
160+
/**
161+
* Check if Password field is visible.
162+
*
163+
* @return boolean
164+
*/
165+
public function isPasswordVisible()
166+
{
167+
$mapping = $this->dataMapping();
168+
return $this->_rootElement->find(
169+
$mapping['password']['selector'],
170+
$mapping['password']['strategy']
171+
)->isVisible();
172+
}
173+
174+
/**
175+
* Check if Confirmation field is visible.
176+
*
177+
* @return boolean
178+
*/
179+
public function isConfirmPasswordVisible()
180+
{
181+
$mapping = $this->dataMapping();
182+
return $this->_rootElement->find(
183+
$mapping['confirmation']['selector'],
184+
$mapping['confirmation']['strategy']
185+
)->isVisible();
186+
}
187+
188+
/**
189+
* Check if Email field is visible.
190+
*
191+
* @return boolean
192+
*/
193+
public function isEmailVisible()
194+
{
195+
$mapping = $this->dataMapping();
196+
return $this->_rootElement->find(
197+
$mapping['email']['selector'],
198+
$mapping['email']['strategy']
199+
)->isVisible();
200+
}
113201
}

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<fields>
1010
<firstname />
1111
<lastname />
12+
<change_email>
13+
<input>checkbox</input>
14+
</change_email>
15+
<change_password>
16+
<input>checkbox</input>
17+
</change_password>
1218
<email />
1319
<current_password />
1420
<password />

dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
<page name="CustomerAccountEdit" mca="customer/account/edit" module="Magento_Customer">
1010
<block name="accountInfoForm" class="Magento\Customer\Test\Block\Form\CustomerForm" locator="#form-validate" strategy="css selector"/>
1111
<block name="messages" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector"/>
12+
<block name="accountMenuBlock" class="Magento\Customer\Test\Block\Account\Links" locator=".nav.items" strategy="css selector"/>
1213
</page>
1314
</config>

0 commit comments

Comments
 (0)