Skip to content

Commit cf288e6

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2 into ASI-1487
2 parents 2448fd8 + f61214d commit cf288e6

File tree

72 files changed

+435
-297
lines changed

Some content is hidden

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

72 files changed

+435
-297
lines changed

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@
7676
<argument name="tags" value=""/>
7777
</actionGroup>
7878
<!--Open Index Management Page -->
79-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
80-
<waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/>
79+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
8180
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
8281
<!--Verify Category In Store Front-->
8382
<amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7777
<argument name="tags" value=""/>
7878
</actionGroup>
79-
<!--Open Index Management Page -->
80-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
81-
<waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/>
79+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
8280
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
8381
<!--Verify Category In Store Front-->
8482
<amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@
7777
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7878
<argument name="tags" value=""/>
7979
</actionGroup>
80-
<!--Open Index Management Page -->
81-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
82-
<waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/>
80+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
8381
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
8482
<!--Verify Category In Store Front-->
8583
<amOnPage url="/$$category.name$$.html" stepKey="openCategoryPage1"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
<createData entity="_defaultCategory" stepKey="createSecondCategory"/>
2626

2727
<!-- Switch "Category Product" and "Product Category" indexers to "Update by Schedule" mode -->
28-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/>
29-
<waitForPageLoad stepKey="waitForManagementPage"/>
28+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="onIndexManagement"/>
3029

3130
<actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct">
3231
<argument name="indexerValue" value="catalog_category_product"/>
@@ -38,8 +37,7 @@
3837

3938
<after>
4039
<!-- Switch "Category Product" and "Product Category" indexers to "Update by Save" mode -->
41-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="onIndexManagement"/>
42-
<waitForPageLoad stepKey="waitForManagementPage"/>
40+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="onIndexManagement"/>
4341

4442
<actionGroup ref="AdminSwitchIndexerToActionModeActionGroup" stepKey="switchCategoryProduct">
4543
<argument name="indexerValue" value="catalog_category_product"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@
8989
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
9090
<argument name="tags" value=""/>
9191
</actionGroup>
92-
<!--Open Index Management Page -->
93-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
94-
<waitForPageLoad stepKey="waitForIndexPageToLoad"/>
92+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
9593
<see stepKey="seeCategoryIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
9694
<!--Verify Product In Store Front-->
9795
<amOnPage url="$$createSimpleProduct.name$$.html" stepKey="goToStorefrontPage"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@
7171
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7272
<argument name="tags" value=""/>
7373
</actionGroup>
74-
<!--Open Index Management Page -->
75-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
76-
<waitForPageLoad stepKey="waitForIndexPageToBeLoaded"/>
74+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
7775
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="Ready"/>
7876
<!--Verify Category In Store Front-->
7977
<amOnPage url="/$$createCategory.name$$.html" stepKey="openCategoryPage1"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
7777
<argument name="tags" value=""/>
7878
</actionGroup>
79-
<!--Open Index Management Page -->
80-
<amOnPage url="{{AdminIndexManagementPage.url}}" stepKey="openIndexManagementPage"/>
81-
<waitForPageLoad stepKey="waitForIndexPageToLoad"/>
79+
<actionGroup ref="AdminOpenIndexManagementPageActionGroup" stepKey="openIndexManagementPage"/>
8280
<see stepKey="seeIndexStatus" selector="{{AdminIndexManagementSection.indexerStatus('Category Flat Data')}}" userInput="READY"/>
8381
<!--Verify Category In Store Front-->
8482
<amOnPage url="{{SimpleSubCategory.name}}.html" stepKey="goToStorefrontPage"/>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminOpenCatalogSearchTermIndexPageActionGroup">
12+
<annotations>
13+
<description>Open catalog search term index page.</description>
14+
</annotations>
15+
16+
<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openCatalogSearchTermIndexPage"/>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
<deleteData createDataKey="createCategory1" stepKey="deleteCategory1"/>
4040

4141
<!-- Delete all search terms -->
42-
<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage"/>
43-
<waitForPageLoad stepKey="waitForAdminCatalogSearchTermIndexPageLoad"/>
42+
<actionGroup ref="AdminOpenCatalogSearchTermIndexPageActionGroup" stepKey="openAdminCatalogSearchTermIndexPage"/>
4443
<comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/>
4544
<actionGroup ref="AdminDeleteAllSearchTermsActionGroup" stepKey="deleteAllSearchTerms"/>
4645

@@ -53,8 +52,7 @@
5352

5453
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
5554

56-
<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage1"/>
57-
<waitForPageLoad stepKey="waitForPageLoad1"/>
55+
<actionGroup ref="AdminOpenCatalogSearchTermIndexPageActionGroup" stepKey="openAdminCatalogSearchTermIndexPage1"/>
5856

5957
<actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByFirstSearchQuery1">
6058
<argument name="searchQuery" value="$$createProduct1.name$$"/>
@@ -67,8 +65,7 @@
6765
<argument name="searchTerm" value="UpdatedSearchTermData1"/>
6866
</actionGroup>
6967

70-
<amOnPage url="{{AdminCatalogSearchTermIndexPage.url}}" stepKey="openAdminCatalogSearchTermIndexPage2"/>
71-
<waitForPageLoad stepKey="waitForPageLoad3"/>
68+
<actionGroup ref="AdminOpenCatalogSearchTermIndexPageActionGroup" stepKey="openAdminCatalogSearchTermIndexPage2"/>
7269

7370
<actionGroup ref="AdminSearchTermFilterBySearchQueryActionGroup" stepKey="filterByFirstSearchQuery2">
7471
<argument name="searchQuery" value="{{UpdatedSearchTermData1.query_text}}"/>

app/code/Magento/Customer/Observer/AfterAddressSaveObserver.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Customer\Observer;
89

@@ -17,6 +18,7 @@
1718
use Magento\Framework\App\State as AppState;
1819
use Magento\Framework\DataObject;
1920
use Magento\Framework\Escaper;
21+
use Magento\Framework\Event\Observer;
2022
use Magento\Framework\Event\ObserverInterface;
2123
use Magento\Framework\Message\ManagerInterface;
2224
use Magento\Framework\Registry;
@@ -25,6 +27,7 @@
2527
/**
2628
* Customer Observer Model
2729
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2831
*/
2932
class AfterAddressSaveObserver implements ObserverInterface
3033
{
@@ -114,11 +117,11 @@ public function __construct(
114117
/**
115118
* Address after save event handler
116119
*
117-
* @param \Magento\Framework\Event\Observer $observer
120+
* @param Observer $observer
118121
* @return void
119122
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
120123
*/
121-
public function execute(\Magento\Framework\Event\Observer $observer)
124+
public function execute(Observer $observer)
122125
{
123126
/** @var $customerAddress Address */
124127
$customerAddress = $observer->getCustomerAddress();
@@ -280,7 +283,7 @@ protected function addInvalidMessage($customerAddress)
280283
$message[] = (string)__('You will be charged tax.');
281284
}
282285

283-
$this->messageManager->addError(implode(' ', $message));
286+
$this->messageManager->addErrorMessage(implode(' ', $message));
284287

285288
return $this;
286289
}
@@ -307,7 +310,7 @@ protected function addErrorMessage($customerAddress)
307310
$email = $this->scopeConfig->getValue('trans_email/ident_support/email', ScopeInterface::SCOPE_STORE);
308311
$message[] = (string)__('If you believe this is an error, please contact us at %1', $email);
309312

310-
$this->messageManager->addError(implode(' ', $message));
313+
$this->messageManager->addErrorMessage(implode(' ', $message));
311314

312315
return $this;
313316
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AssertStorefrontCustomerLogoutSuccessPageActionGroup">
12+
<annotations>
13+
<description>Assert on the Storefront Customer Logout Success Page page.</description>
14+
</annotations>
15+
16+
<seeInCurrentUrl url="{{StorefrontCustomerLogoutSuccessPage.url}}" stepKey="seeOnSignInPage"/>
17+
</actionGroup>
18+
</actionGroups>

app/code/Magento/Customer/Test/Unit/Observer/AfterAddressSaveObserverTest.php

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,23 @@ class AfterAddressSaveObserverTest extends TestCase
8080
protected $appState;
8181

8282
/**
83-
* @var Customer|MockObject
83+
* @var Session|MockObject
8484
*/
85-
protected $customerMock;
85+
protected $customerSessionMock;
8686

8787
/**
88-
* @var Session|MockObject
88+
* @var GroupInterface|MockObject
8989
*/
90-
protected $customerSessionMock;
90+
protected $group;
9191

9292
protected function setUp(): void
9393
{
94-
$this->vat = $this->getMockBuilder(Vat::class)
95-
->disableOriginalConstructor()
96-
->getMock();
97-
98-
$this->helperAddress = $this->getMockBuilder(\Magento\Customer\Helper\Address::class)
99-
->disableOriginalConstructor()
100-
->getMock();
101-
102-
$this->registry = $this->getMockBuilder(Registry::class)
103-
->disableOriginalConstructor()
104-
->getMock();
105-
94+
$this->vat = $this->createMock(Vat::class);
95+
$this->helperAddress = $this->createMock(HelperAddress::class);
96+
$this->registry = $this->createMock(Registry::class);
97+
$this->escaper = $this->createMock(Escaper::class);
98+
$this->appState = $this->createMock(AppState::class);
99+
$this->customerSessionMock = $this->createMock(Session::class);
106100
$this->group = $this->getMockBuilder(GroupInterface::class)
107101
->setMethods(['getId'])
108102
->getMockForAbstractClass();
@@ -114,22 +108,9 @@ protected function setUp(): void
114108

115109
$this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class)
116110
->getMockForAbstractClass();
117-
118111
$this->messageManager = $this->getMockBuilder(ManagerInterface::class)
119112
->getMockForAbstractClass();
120113

121-
$this->escaper = $this->getMockBuilder(Escaper::class)
122-
->disableOriginalConstructor()
123-
->getMock();
124-
125-
$this->appState = $this->getMockBuilder(\Magento\Framework\App\State::class)
126-
->disableOriginalConstructor()
127-
->getMock();
128-
129-
$this->customerSessionMock = $this->getMockBuilder(Session::class)
130-
->disableOriginalConstructor()
131-
->getMock();
132-
133114
$this->model = new AfterAddressSaveObserver(
134115
$this->vat,
135116
$this->helperAddress,
@@ -595,7 +576,7 @@ public function testAfterAddressSaveNewGroup(
595576
->with($vatId)
596577
->willReturn($vatId);
597578
$this->messageManager->expects($this->once())
598-
->method('addError')
579+
->method('addErrorMessage')
599580
->with($resultInvalidMessage)
600581
->willReturnSelf();
601582
}
@@ -605,7 +586,7 @@ public function testAfterAddressSaveNewGroup(
605586
->with('trans_email/ident_support/email', ScopeInterface::SCOPE_STORE)
606587
->willReturn('[email protected]');
607588
$this->messageManager->expects($this->once())
608-
->method('addError')
589+
->method('addErrorMessage')
609590
->with($resultErrorMessage)
610591
->willReturnSelf();
611592
}

app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Link.php

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,36 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit;
810

11+
use Magento\Catalog\Controller\Adminhtml\Product\Edit as ProductEdit;
912
use Magento\Downloadable\Helper\Download as DownloadHelper;
13+
use Magento\Downloadable\Helper\File;
14+
use Magento\Downloadable\Model\Link as ModelLink;
1015
use Magento\Framework\App\Response\Http as HttpResponse;
1116

12-
class Link extends \Magento\Catalog\Controller\Adminhtml\Product\Edit
17+
class Link extends ProductEdit
1318
{
1419
/**
15-
* @return \Magento\Downloadable\Model\Link
20+
* Create link
21+
*
22+
* @return ModelLink
1623
*/
1724
protected function _createLink()
1825
{
19-
return $this->_objectManager->create(\Magento\Downloadable\Model\Link::class);
26+
return $this->_objectManager->create(ModelLink::class);
2027
}
2128

2229
/**
23-
* @return \Magento\Downloadable\Model\Link
30+
* Get link
31+
*
32+
* @return ModelLink
2433
*/
2534
protected function _getLink()
2635
{
27-
return $this->_objectManager->get(\Magento\Downloadable\Model\Link::class);
36+
return $this->_objectManager->get(ModelLink::class);
2837
}
2938

3039
/**
@@ -34,10 +43,10 @@ protected function _getLink()
3443
* @param string $resourceType
3544
* @return void
3645
*/
37-
protected function _processDownload($resource, $resourceType)
46+
protected function _processDownload(string $resource, string $resourceType)
3847
{
39-
/* @var $helper \Magento\Downloadable\Helper\Download */
40-
$helper = $this->_objectManager->get(\Magento\Downloadable\Helper\Download::class);
48+
/* @var $helper DownloadHelper */
49+
$helper = $this->_objectManager->get(DownloadHelper::class);
4150
$helper->setResource($resource, $resourceType);
4251

4352
$fileName = $helper->getFilename();
@@ -77,7 +86,7 @@ protected function _processDownload($resource, $resourceType)
7786
//Rendering
7887
$response->clearBody();
7988
$response->sendHeaders();
80-
89+
8190
$helper->output();
8291
}
8392

@@ -90,7 +99,7 @@ public function execute()
9099
{
91100
$linkId = $this->getRequest()->getParam('id', 0);
92101
$type = $this->getRequest()->getParam('type', 0);
93-
/** @var \Magento\Downloadable\Model\Link $link */
102+
/** @var ModelLink $link */
94103
$link = $this->_createLink()->load($linkId);
95104
if ($link->getId()) {
96105
$resource = '';
@@ -101,7 +110,7 @@ public function execute()
101110
$resourceType = DownloadHelper::LINK_TYPE_URL;
102111
} elseif ($link->getLinkType() == DownloadHelper::LINK_TYPE_FILE) {
103112
$resource = $this->_objectManager->get(
104-
\Magento\Downloadable\Helper\File::class
113+
File::class
105114
)->getFilePath(
106115
$this->_getLink()->getBasePath(),
107116
$link->getLinkFile()
@@ -114,7 +123,7 @@ public function execute()
114123
$resourceType = DownloadHelper::LINK_TYPE_URL;
115124
} elseif ($link->getSampleType() == DownloadHelper::LINK_TYPE_FILE) {
116125
$resource = $this->_objectManager->get(
117-
\Magento\Downloadable\Helper\File::class
126+
File::class
118127
)->getFilePath(
119128
$this->_getLink()->getBaseSamplePath(),
120129
$link->getSampleFile()
@@ -125,7 +134,7 @@ public function execute()
125134
try {
126135
$this->_processDownload($resource, $resourceType);
127136
} catch (\Magento\Framework\Exception\LocalizedException $e) {
128-
$this->messageManager->addError(__('Something went wrong while getting the requested content.'));
137+
$this->messageManager->addErrorMessage(__('Something went wrong while getting the requested content.'));
129138
}
130139
}
131140
}

0 commit comments

Comments
 (0)