Skip to content

Commit fbc6439

Browse files
merge magento/2.3-develop into magento-tsg/2.3-develop-pr78
2 parents 2a5bf1f + 7312e56 commit fbc6439

File tree

263 files changed

+8070
-1618
lines changed

Some content is hidden

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

263 files changed

+8070
-1618
lines changed
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSystemMessagesWarningActionGroup">
12+
<annotations>
13+
<description>Check warning system message exists.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="message" type="string"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{AdminSystemMessagesSection.systemMessagesDropdown}}" stepKey="waitMessagesDropdownAppears"/>
20+
<conditionalClick selector="{{AdminSystemMessagesSection.systemMessagesDropdown}}" dependentSelector="{{AdminSystemMessagesSection.messagesBlock}}" visible="false" stepKey="openMessagesBlockIfCollapsed"/>
21+
<see userInput="{{message}}" selector="{{AdminSystemMessagesSection.warning}}" stepKey="seeWarningMessage"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/AdminNotification/Test/Mftf/Section/AdminSystemMessagesSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
<section name="AdminSystemMessagesSection">
1212
<element name="systemMessagesDropdown" type="button" selector="#system_messages .message-system-action-dropdown"/>
1313
<element name="actionMessageLog" type="button" selector="//*[contains(@class, 'message-system-summary')]/a[contains(text(), '{{textMessage}}')]" parameterized="true"/>
14+
<element name="messagesBlock" type="block" selector="#system_messages div.message-system-collapsible"/>
15+
<element name="success" type="text" selector="#system_messages div.message-success"/>
16+
<element name="warning" type="text" selector="#system_messages div.message-warning"/>
17+
<element name="notice" type="text" selector="#system_messages div.message-notice"/>
1418
</section>
1519
</sections>

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ public function getHintHtml()
592592
'What is this?'
593593
) . '"' . ' class="admin__field-tooltip-action action-help"><span>' . __(
594594
'What is this?'
595-
) . '</span></a></span>' . ' </div>';
595+
) . '</span></a>' . ' </div>';
596596
}
597597
return $html;
598598
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,13 @@
1414
<element name="error" type="text" selector="#messages div.message-error"/>
1515
<element name="notice" type="text" selector=".message.message-notice.notice"/>
1616
<element name="messageByType" type="text" selector="#messages div.message-{{messageType}}" parameterized="true" />
17+
<element name="warning" type="text" selector="#messages div.message-warning"/>
18+
<element name="accessDenied" type="text" selector=".access-denied-page"/>
19+
<!-- Deprecated elements, please do not use them. Use elements above-->
20+
<!-- Elements below are too common and catch non messages blocks. Ex: system messages blocks-->
21+
<element name="successMessage" type="text" selector=".message-success"/>
22+
<element name="errorMessage" type="text" selector=".message.message-error.error"/>
23+
<element name="warningMessage" type="text" selector=".message-warning"/>
24+
<element name="noticeMessage" type="text" selector=".message-notice"/>
1725
</section>
1826
</sections>

app/code/Magento/CardinalCommerce/etc/adminhtml/system.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,41 @@
1919
<label>Environment</label>
2020
<source_model>Magento\CardinalCommerce\Model\Adminhtml\Source\Environment</source_model>
2121
<config_path>three_d_secure/cardinal/environment</config_path>
22+
<depends>
23+
<field id="enabled_authorize">1</field>
24+
</depends>
2225
</field>
2326
<field id="org_unit_id" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
2427
<label>Org Unit Id</label>
2528
<config_path>three_d_secure/cardinal/org_unit_id</config_path>
2629
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
30+
<depends>
31+
<field id="enabled_authorize">1</field>
32+
</depends>
2733
</field>
2834
<field id="api_key" translate="label" type="obscure" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
2935
<label>API Key</label>
3036
<config_path>three_d_secure/cardinal/api_key</config_path>
3137
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
38+
<depends>
39+
<field id="enabled_authorize">1</field>
40+
</depends>
3241
</field>
3342
<field id="api_identifier" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
3443
<label>API Identifier</label>
3544
<config_path>three_d_secure/cardinal/api_identifier</config_path>
3645
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
46+
<depends>
47+
<field id="enabled_authorize">1</field>
48+
</depends>
3749
</field>
3850
<field id="debug" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
3951
<label>Debug</label>
4052
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
4153
<config_path>three_d_secure/cardinal/debug</config_path>
54+
<depends>
55+
<field id="enabled_authorize">1</field>
56+
</depends>
4257
</field>
4358
</group>
4459
</group>

app/code/Magento/Catalog/Controller/Adminhtml/Category.php

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77

88
namespace Magento\Catalog\Controller\Adminhtml;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Store\Model\Store;
12+
use Magento\Framework\Controller\ResultFactory;
1113

1214
/**
1315
* Catalog category controller
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1417
*/
1518
abstract class Category extends \Magento\Backend\App\Action
1619
{
@@ -26,20 +29,61 @@ abstract class Category extends \Magento\Backend\App\Action
2629
*/
2730
protected $dateFilter;
2831

32+
/**
33+
* @var \Magento\Store\Model\StoreManagerInterface
34+
*/
35+
private $storeManager;
36+
37+
/**
38+
* @var \Magento\Framework\Registry
39+
*/
40+
private $registry;
41+
42+
/**
43+
* @var \Magento\Cms\Model\Wysiwyg\Config
44+
*/
45+
private $wysiwigConfig;
46+
47+
/**
48+
* @var \Magento\Backend\Model\Auth\Session
49+
*/
50+
private $authSession;
51+
2952
/**
3053
* @param \Magento\Backend\App\Action\Context $context
3154
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date|null $dateFilter
55+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
56+
* @param \Magento\Framework\Registry $registry
57+
* @param \Magento\Cms\Model\Wysiwyg\Config $wysiwigConfig
58+
* @param \Magento\Backend\Model\Auth\Session $authSession
3259
*/
3360
public function __construct(
3461
\Magento\Backend\App\Action\Context $context,
35-
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter = null
62+
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter = null,
63+
\Magento\Store\Model\StoreManagerInterface $storeManager = null,
64+
\Magento\Framework\Registry $registry = null,
65+
\Magento\Cms\Model\Wysiwyg\Config $wysiwigConfig = null,
66+
\Magento\Backend\Model\Auth\Session $authSession = null
3667
) {
3768
$this->dateFilter = $dateFilter;
69+
$this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(
70+
\Magento\Store\Model\StoreManagerInterface::class
71+
);
72+
$this->registry = $registry ?: ObjectManager::getInstance()->get(
73+
\Magento\Framework\Registry::class
74+
);
75+
$this->wysiwigConfig = $wysiwigConfig ?: ObjectManager::getInstance()->get(
76+
\Magento\Cms\Model\Wysiwyg\Config::class
77+
);
78+
$this->authSession = $authSession ?: ObjectManager::getInstance()->get(
79+
\Magento\Backend\Model\Auth\Session::class
80+
);
3881
parent::__construct($context);
3982
}
4083

4184
/**
42-
* Initialize requested category and put it into registry.
85+
* Initialize requested category and put it into registry
86+
*
4387
* Root category can be returned, if inappropriate store/category is specified
4488
*
4589
* @param bool $getRootInstead
@@ -55,11 +99,7 @@ protected function _initCategory($getRootInstead = false)
5599
if ($categoryId) {
56100
$category->load($categoryId);
57101
if ($storeId) {
58-
$rootId = $this->_objectManager->get(
59-
\Magento\Store\Model\StoreManagerInterface::class
60-
)->getStore(
61-
$storeId
62-
)->getRootCategoryId();
102+
$rootId = $this->storeManager->getStore($storeId)->getRootCategoryId();
63103
if (!in_array($rootId, $category->getPathIds())) {
64104
// load root category instead wrong one
65105
if ($getRootInstead) {
@@ -71,10 +111,9 @@ protected function _initCategory($getRootInstead = false)
71111
}
72112
}
73113

74-
$this->_objectManager->get(\Magento\Framework\Registry::class)->register('category', $category);
75-
$this->_objectManager->get(\Magento\Framework\Registry::class)->register('current_category', $category);
76-
$this->_objectManager->get(\Magento\Cms\Model\Wysiwyg\Config::class)
77-
->setStoreId($storeId);
114+
$this->registry->register('category', $category);
115+
$this->registry->register('current_category', $category);
116+
$this->wysiwigConfig->setStoreId($storeId);
78117
return $category;
79118
}
80119

@@ -91,9 +130,8 @@ private function resolveCategoryId() : int
91130
}
92131

93132
/**
94-
* Resolve store id
133+
* Resolve store Id, tries to take store id from store HTTP parameter
95134
*
96-
* Tries to take store id from store HTTP parameter
97135
* @see Store
98136
*
99137
* @return int
@@ -121,11 +159,7 @@ protected function ajaxRequestResponse($category, $resultPage)
121159
$breadcrumbsPath = $category->getPath();
122160
if (empty($breadcrumbsPath)) {
123161
// but if no category, and it is deleted - prepare breadcrumbs from path, saved in session
124-
$breadcrumbsPath = $this->_objectManager->get(
125-
\Magento\Backend\Model\Auth\Session::class
126-
)->getDeletedPath(
127-
true
128-
);
162+
$breadcrumbsPath = $this->authSession->getDeletedPath(true);
129163
if (!empty($breadcrumbsPath)) {
130164
$breadcrumbsPath = explode('/', $breadcrumbsPath);
131165
// no need to get parent breadcrumbs if deleting category level 1
@@ -138,19 +172,21 @@ protected function ajaxRequestResponse($category, $resultPage)
138172
}
139173
}
140174

141-
$eventResponse = new \Magento\Framework\DataObject([
142-
'content' => $resultPage->getLayout()->getUiComponent('category_form')->getFormHtml()
143-
. $resultPage->getLayout()->getBlock('category.tree')
144-
->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs'),
145-
'messages' => $resultPage->getLayout()->getMessagesBlock()->getGroupedHtml(),
146-
'toolbar' => $resultPage->getLayout()->getBlock('page.actions.toolbar')->toHtml()
147-
]);
175+
$eventResponse = new \Magento\Framework\DataObject(
176+
[
177+
'content' => $resultPage->getLayout()->getUiComponent('category_form')->getFormHtml()
178+
. $resultPage->getLayout()->getBlock('category.tree')
179+
->getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs'),
180+
'messages' => $resultPage->getLayout()->getMessagesBlock()->getGroupedHtml(),
181+
'toolbar' => $resultPage->getLayout()->getBlock('page.actions.toolbar')->toHtml()
182+
]
183+
);
148184
$this->_eventManager->dispatch(
149185
'category_prepare_ajax_response',
150186
['response' => $eventResponse, 'controller' => $this]
151187
);
152188
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
153-
$resultJson = $this->_objectManager->get(\Magento\Framework\Controller\Result\Json::class);
189+
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
154190
$resultJson->setHeader('Content-type', 'application/json', true);
155191
$resultJson->setData($eventResponse->getData());
156192
return $resultJson;

app/code/Magento/Catalog/Controller/Adminhtml/Category/CategoriesJson.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Catalog\Controller\Adminhtml\Category;
87

98
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
9+
use Magento\Framework\App\ObjectManager;
1010

11+
/**
12+
* Class CategoriesJson
13+
*/
1114
class CategoriesJson extends \Magento\Catalog\Controller\Adminhtml\Category implements HttpPostActionInterface
1215
{
1316
/**
@@ -20,19 +23,28 @@ class CategoriesJson extends \Magento\Catalog\Controller\Adminhtml\Category impl
2023
*/
2124
protected $layoutFactory;
2225

26+
/**
27+
* @var \Magento\Backend\Model\Auth\Session
28+
*/
29+
private $authSession;
30+
2331
/**
2432
* @param \Magento\Backend\App\Action\Context $context
2533
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
2634
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
35+
* @param \Magento\Backend\Model\Auth\Session $authSession
2736
*/
2837
public function __construct(
2938
\Magento\Backend\App\Action\Context $context,
3039
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
31-
\Magento\Framework\View\LayoutFactory $layoutFactory
40+
\Magento\Framework\View\LayoutFactory $layoutFactory,
41+
\Magento\Backend\Model\Auth\Session $authSession = null
3242
) {
3343
parent::__construct($context);
3444
$this->resultJsonFactory = $resultJsonFactory;
3545
$this->layoutFactory = $layoutFactory;
46+
$this->authSession = $authSession ?: ObjectManager::getInstance()
47+
->get(\Magento\Backend\Model\Auth\Session::class);
3648
}
3749

3850
/**
@@ -43,9 +55,9 @@ public function __construct(
4355
public function execute()
4456
{
4557
if ($this->getRequest()->getParam('expand_all')) {
46-
$this->_objectManager->get(\Magento\Backend\Model\Auth\Session::class)->setIsTreeWasExpanded(true);
58+
$this->authSession->setIsTreeWasExpanded(true);
4759
} else {
48-
$this->_objectManager->get(\Magento\Backend\Model\Auth\Session::class)->setIsTreeWasExpanded(false);
60+
$this->authSession->setIsTreeWasExpanded(false);
4961
}
5062
$categoryId = (int)$this->getRequest()->getPost('id');
5163
if ($categoryId) {

0 commit comments

Comments
 (0)