Skip to content

Commit efe5d7c

Browse files
committed
Merge branch '2.2-tests-pr' into MC-6621
fix merge conflict
2 parents 9cf03c6 + e72c183 commit efe5d7c

File tree

721 files changed

+9372
-4963
lines changed

Some content is hidden

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

721 files changed

+9372
-4963
lines changed

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel
2525

2626
const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update';
2727

28+
/**
29+
* @var \Magento\Framework\Escaper
30+
*/
31+
private $escaper;
32+
2833
/**
2934
* Feed url
3035
*
@@ -77,6 +82,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel
7782
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
7883
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
7984
* @param array $data
85+
* @param \Magento\Framework\Escaper|null $escaper
8086
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8187
*/
8288
public function __construct(
@@ -90,7 +96,8 @@ public function __construct(
9096
\Magento\Framework\UrlInterface $urlBuilder,
9197
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
9298
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
93-
array $data = []
99+
array $data = [],
100+
\Magento\Framework\Escaper $escaper = null
94101
) {
95102
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
96103
$this->_backendConfig = $backendConfig;
@@ -99,12 +106,16 @@ public function __construct(
99106
$this->_deploymentConfig = $deploymentConfig;
100107
$this->productMetadata = $productMetadata;
101108
$this->urlBuilder = $urlBuilder;
109+
$this->escaper = $escaper ?? \Magento\Framework\App\ObjectManager::getInstance()->get(
110+
\Magento\Framework\Escaper::class
111+
);
102112
}
103113

104114
/**
105115
* Init model
106116
*
107117
* @return void
118+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
108119
*/
109120
protected function _construct()
110121
{
@@ -255,6 +266,6 @@ public function getFeedXml()
255266
*/
256267
private function escapeString(\SimpleXMLElement $data)
257268
{
258-
return htmlspecialchars((string)$data);
269+
return $this->escaper->escapeHtml((string)$data);
259270
}
260271
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminSystemMessagesSection">
12+
<element name="systemMessagesDropdown" type="button" selector="#system_messages .message-system-action-dropdown"/>
13+
<element name="actionMessageLog" type="button" selector="//*[contains(@class, 'message-system-summary')]/a[contains(text(), '{{textMessage}}')]" parameterized="true"/>
14+
</section>
15+
</sections>

app/code/Magento/AdminNotification/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-admin-notification",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-store": "100.2.*",
77
"magento/module-backend": "100.2.*",
88
"magento/module-media-storage": "100.2.*",

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-advanced-pricing-import-export",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-catalog": "102.0.*",
77
"magento/module-catalog-inventory": "100.2.*",
88
"magento/module-eav": "101.0.*",

app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/CollectionTimeLabelTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ protected function setUp()
4040
->setMethods(['getComment', 'getHtmlId', 'getName'])
4141
->disableOriginalConstructor()
4242
->getMock();
43+
44+
$objectManager = new ObjectManager($this);
45+
$escaper = $objectManager->getObject(\Magento\Framework\Escaper::class);
46+
$objectManager->setBackwardCompatibleProperty(
47+
$this->abstractElementMock,
48+
'_escaper',
49+
$escaper
50+
);
51+
4352
$this->contextMock = $this->getMockBuilder(Context::class)
4453
->setMethods(['getLocaleDate'])
4554
->disableOriginalConstructor()

app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/SubscriptionStatusLabelTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ protected function setUp()
5454
->setMethods(['getComment', 'getHtmlId', 'getName'])
5555
->disableOriginalConstructor()
5656
->getMock();
57+
58+
$objectManager = new ObjectManager($this);
59+
$escaper = $objectManager->getObject(\Magento\Framework\Escaper::class);
60+
$objectManager->setBackwardCompatibleProperty(
61+
$this->abstractElementMock,
62+
'_escaper',
63+
$escaper
64+
);
65+
5766
$this->formMock = $this->getMockBuilder(Form::class)
5867
->disableOriginalConstructor()
5968
->getMock();

app/code/Magento/Analytics/Test/Unit/Block/Adminhtml/System/Config/VerticalTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ protected function setUp()
3939
->setMethods(['getComment', 'getLabel', 'getHint', 'getHtmlId', 'getName'])
4040
->disableOriginalConstructor()
4141
->getMock();
42+
43+
$objectManager = new ObjectManager($this);
44+
$escaper = $objectManager->getObject(\Magento\Framework\Escaper::class);
45+
$objectManager->setBackwardCompatibleProperty(
46+
$this->abstractElementMock,
47+
'_escaper',
48+
$escaper
49+
);
50+
4251
$this->contextMock = $this->getMockBuilder(Context::class)
4352
->disableOriginalConstructor()
4453
->getMock();

app/code/Magento/Analytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-analytics",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-backend": "100.2.*",
77
"magento/module-config": "101.0.*",
88
"magento/module-integration": "100.2.*",

app/code/Magento/Authorization/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-authorization",
33
"description": "Authorization module provides access to Magento ACL functionality.",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-backend": "100.2.*",
77
"magento/framework": "101.0.*"
88
},

app/code/Magento/Authorizenet/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-authorizenet",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-sales": "101.0.*",
77
"magento/module-store": "100.2.*",
88
"magento/module-quote": "101.0.*",

app/code/Magento/Backend/Block/Dashboard/Bar.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Backend\Block\Dashboard;
77

8+
use Magento\Store\Model\Store;
9+
810
/**
911
* Adminhtml dashboard bar block
1012
*
@@ -73,6 +75,7 @@ public function setCurrency($currency)
7375
* Retrieve currency model if not set then return currency model for current store
7476
*
7577
* @return \Magento\Directory\Model\Currency
78+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
7679
*/
7780
public function getCurrency()
7881
{
@@ -90,7 +93,8 @@ public function getCurrency()
9093
$this->getRequest()->getParam('group')
9194
)->getWebsite()->getBaseCurrency();
9295
} else {
93-
$this->_currentCurrencyCode = $this->_storeManager->getStore()->getBaseCurrency();
96+
$this->_currentCurrencyCode = $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)
97+
->getBaseCurrency();
9498
}
9599
}
96100

app/code/Magento/Backend/Block/Menu.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,15 @@ protected function _getAnchorLabel($menuItem)
143143

144144
/**
145145
* Render menu item mouse events
146+
*
146147
* @param \Magento\Backend\Model\Menu\Item $menuItem
147148
* @return string
148149
*/
149150
protected function _renderMouseEvent($menuItem)
150151
{
151-
return $menuItem->hasChildren() ? 'onmouseover="Element.addClassName(this,\'over\')" onmouseout="Element.removeClassName(this,\'over\')"' : '';
152+
return $menuItem->hasChildren()
153+
? 'onmouseover="Element.addClassName(this,\'over\')" onmouseout="Element.removeClassName(this,\'over\')"'
154+
: '';
152155
}
153156

154157
/**
@@ -216,7 +219,7 @@ protected function _callbackSecretKey($match)
216219
{
217220
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
218221
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
219-
$routeId,
222+
$routeId ?: $match[1],
220223
$match[2],
221224
$match[3]
222225
);
@@ -399,7 +402,11 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
399402
$itemName = substr($menuId, strrpos($menuId, '::') + 2);
400403
$itemClass = str_replace('_', '-', strtolower($itemName));
401404

402-
if (count($colBrakes) && $colBrakes[$itemPosition]['colbrake'] && $itemPosition != 1) {
405+
if (is_array($colBrakes)
406+
&& count($colBrakes)
407+
&& $colBrakes[$itemPosition]['colbrake']
408+
&& $itemPosition != 1
409+
) {
403410
$output .= '</ul></li><li class="column"><ul role="menu">';
404411
}
405412

@@ -413,7 +420,7 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
413420
$itemPosition++;
414421
}
415422

416-
if (count($colBrakes) && $limit) {
423+
if (is_array($colBrakes) && count($colBrakes) && $limit) {
417424
$output = '<li class="column"><ul role="menu">' . $output . '</ul></li>';
418425
}
419426

app/code/Magento/Backend/Block/Widget/Grid/ColumnSet.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public function getRowUrl($item)
258258
*/
259259
public function getMultipleRows($item)
260260
{
261-
return $item->getChildren();
261+
$children = $item->getChildren();
262+
return $children ?: [];
262263
}
263264

264265
/**
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertAdminDashboardPageIsVisibleActionGroup">
12+
<seeInCurrentUrl url="{{AdminDashboardPage.url}}" stepKey="seeDashboardUrl"/>
13+
<see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/ActionGroup/ConfigurationActionGroup.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
*/
77
-->
88

9-
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10-
<actionGroup name="NavigateToConfigurationGeneralPage">
11-
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToConfigGeneralPage"/>
12-
<waitForPageLoad stepKey="waitForConfigPageLoad"/>
13-
</actionGroup>
14-
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1510
<actionGroup name="SelectTopDestinationsCountry">
1611
<arguments>
1712
<argument name="countries"/>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ChangedCookieDomainForMainWebsiteConfigData">
12+
<data key="path">web/cookie/cookie_domain</data>
13+
<data key="scope">website</data>
14+
<data key="scope_code">base</data>
15+
<data key="value">testDomain.com</data>
16+
</entity>
17+
<entity name="EmptyCookieDomainForMainWebsiteConfigData">
18+
<data key="path">web/cookie/cookie_domain</data>
19+
<data key="scope">website</data>
20+
<data key="scope_code">base</data>
21+
<data key="value">''</data>
22+
</entity>
23+
</entities>

app/code/Magento/Backend/Test/Mftf/Section/AdminMenuSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
<element name="widgets" type="button" selector="#nav li[data-ui-id='menu-magento-widget-cms-widget-instance']"/>
1616
<element name="stores" type="button" selector="#menu-magento-backend-stores"/>
1717
<element name="configuration" type="button" selector="#nav li[data-ui-id='menu-magento-config-system-config']"/>
18+
19+
<!-- Navigate menu selectors -->
20+
<element name="menuItem" type="button" selector="li[data-ui-id='menu-{{dataUiId}}']" parameterized="true" timeout="30"/>
1821
</section>
1922
</sections>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminLoginAfterChangeCookieDomainTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Login on the Admin Backend"/>
15+
<title value="Admin user can login after changing cookie domain on main website scope without changing cookie domain on default scope"/>
16+
<description value="Admin user can login after changing cookie domain on main website scope without changing cookie domain on default scope"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-17931"/>
19+
<useCaseId value="MC-17292"/>
20+
<group value="backend"/>
21+
</annotations>
22+
<before>
23+
<magentoCLI command="config:set {{ChangedCookieDomainForMainWebsiteConfigData.path}} --scope={{ChangedCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{ChangedCookieDomainForMainWebsiteConfigData.scope_code}} {{ChangedCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteBeforeTestRun"/>
24+
<magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/>
25+
</before>
26+
<after>
27+
<magentoCLI command="config:set {{EmptyCookieDomainForMainWebsiteConfigData.path}} --scope={{EmptyCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{EmptyCookieDomainForMainWebsiteConfigData.scope_code}} {{EmptyCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteAfterTestComplete"/>
28+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestComplete"/>
29+
</after>
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="seeDashboardPage"/>
32+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
33+
</test>
34+
</tests>

app/code/Magento/Backend/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-backend",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.0.13|~7.1.0",
5+
"php": "~7.0.13|~7.1.0|~7.2.0",
66
"magento/module-store": "100.2.*",
77
"magento/module-directory": "100.2.*",
88
"magento/module-developer": "100.2.*",

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<arguments>
8787
<argument name="lifetimePath" xsi:type="const">Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME</argument>
8888
<argument name="sessionName" xsi:type="const">Magento\Backend\Model\Session\AdminConfig::SESSION_NAME_ADMIN</argument>
89+
<argument name="scopeType" xsi:type="const">Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT</argument>
8990
</arguments>
9091
</type>
9192
<type name="Magento\Framework\View\Result\PageFactory">

app/code/Magento/Backend/view/adminhtml/templates/admin/access_denied.phtml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
?>
107
<?php
118
/**
129
* @see \Magento\Backend\Block\Denied
1310
*/
11+
12+
// phpcs:disable Magento2.Security.Superglobal
1413
?>
1514
<hr class="access-denied-hr"/>
1615
<div class="access-denied-page">
@@ -21,10 +20,10 @@
2120
<li><span><?= $block->escapeHtml(__('Contact a system administrator or store owner to gain permissions.')) ?></span></li>
2221
<li>
2322
<span><?= $block->escapeHtml(__('Return to ')) ?>
24-
<?php if(isset($_SERVER['HTTP_REFERER'])): ?>
23+
<?php if (isset($_SERVER['HTTP_REFERER'])) : ?>
2524
<a href="<?= $block->escapeUrl(__($_SERVER['HTTP_REFERER'])) ?>">
2625
<?= $block->escapeHtml(__('previous page')) ?></a><?= $block->escapeHtml(__('.')) ?>
27-
<?php else: ?>
26+
<?php else : ?>
2827
<a href="<?= $block->escapeHtmlAttr(__('javascript:history.back()')) ?>">
2928
<?= $block->escapeHtml(__('previous page')) ?></a><?= $block->escapeHtml(__('.')) ?>
3029
<?php endif ?>

app/code/Magento/Backend/view/adminhtml/templates/admin/formkey.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
* See COPYING.txt for license details.
55
*/
66
?>
7-
<div><input name="form_key" type="hidden" value="<?= /* @escapeNotVerified */ $block->getFormKey() ?>" /></div>
7+
<div><input name="form_key" type="hidden" value="<?= $block->escapeHtmlAttr($block->getFormKey()) ?>" /></div>

0 commit comments

Comments
 (0)