Skip to content

Commit ee78423

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #27676: [MFTF] Added new actionGroup to click on first row on order grid (by @Usik2203) - #27522: PhpUnit 8 Migration - Amqp (by @ihor-sviziev) - #27448: Sitemap Observer Unit Test improvement: Expect email notification to send, and simplify setup a bit. (by @evktalo)
2 parents 03a986d + 1bd7795 commit ee78423

16 files changed

+72
-51
lines changed

app/code/Magento/Amqp/Test/Unit/Setup/ConfigOptionsListTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
namespace Magento\Amqp\Test\Unit\Setup;
88

9+
use Magento\Amqp\Setup\ConnectionValidator;
10+
use Magento\Framework\Config\Data\ConfigData;
911
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1012
use Magento\Amqp\Setup\ConfigOptionsList;
1113
use Magento\Framework\Setup\Option\TextConfigOption;
1214
use Magento\Framework\App\DeploymentConfig;
15+
use PHPUnit\Framework\MockObject\MockObject;
16+
use PHPUnit\Framework\TestCase;
1317

14-
class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
18+
class ConfigOptionsListTest extends TestCase
1519
{
1620
/**
1721
* @var ObjectManager
@@ -24,12 +28,12 @@ class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
2428
private $model;
2529

2630
/**
27-
* @var \Magento\Amqp\Setup\ConnectionValidator|\PHPUnit_Framework_MockObject_MockObject
31+
* @var ConnectionValidator|MockObject
2832
*/
2933
private $connectionValidatorMock;
3034

3135
/**
32-
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
36+
* @var DeploymentConfig|MockObject
3337
*/
3438
private $deploymentConfigMock;
3539

@@ -38,7 +42,7 @@ class ConfigOptionsListTest extends \PHPUnit\Framework\TestCase
3842
*/
3943
private $options;
4044

41-
protected function setUp()
45+
protected function setUp(): void
4246
{
4347
$this->options = [
4448
ConfigOptionsList::INPUT_KEY_QUEUE_AMQP_HOST => 'host',
@@ -51,18 +55,18 @@ protected function setUp()
5155
];
5256

5357
$this->objectManager = new ObjectManager($this);
54-
$this->connectionValidatorMock = $this->getMockBuilder(\Magento\Amqp\Setup\ConnectionValidator::class)
58+
$this->connectionValidatorMock = $this->getMockBuilder(ConnectionValidator::class)
5559
->disableOriginalConstructor()
5660
->setMethods([])
5761
->getMock();
5862

59-
$this->deploymentConfigMock = $this->getMockBuilder(\Magento\Framework\App\DeploymentConfig::class)
63+
$this->deploymentConfigMock = $this->getMockBuilder(DeploymentConfig::class)
6064
->disableOriginalConstructor()
6165
->setMethods([])
6266
->getMock();
6367

6468
$this->model = $this->objectManager->getObject(
65-
\Magento\Amqp\Setup\ConfigOptionsList::class,
69+
ConfigOptionsList::class,
6670
[
6771
'connectionValidator' => $this->connectionValidatorMock,
6872
]
@@ -135,9 +139,9 @@ public function testCreateConfig($options, $expectedConfigData)
135139
$result = $this->model->createConfig($options, $this->deploymentConfigMock);
136140
$this->assertInternalType('array', $result);
137141
$this->assertNotEmpty($result);
138-
/** @var \Magento\Framework\Config\Data\ConfigData $configData */
142+
/** @var ConfigData $configData */
139143
$configData = $result[0];
140-
$this->assertInstanceOf(\Magento\Framework\Config\Data\ConfigData::class, $configData);
144+
$this->assertInstanceOf(ConfigData::class, $configData);
141145
$this->assertEquals($expectedConfigData, $configData->getData());
142146
}
143147

app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
<waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/>
8484
<!-- Create invoice -->
8585
<comment userInput="Create invoice" stepKey="createInvoice"/>
86-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
87-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
86+
87+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
8888
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
8989
<waitForPageLoad stepKey="waitForInvoicePageToLoad"/>
9090
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
@@ -95,8 +95,7 @@
9595
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
9696
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
9797
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
98-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="openOrderPageForShip"/>
99-
<waitForPageLoad stepKey="waitForOrderDetailsPage"/>
98+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="openOrderPageForShip"/>
10099
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
101100
<waitForPageLoad stepKey="waitForShipmentPagePage"/>
102101
<seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById">
7171
<argument name="orderId" value="$grabOrderNumber"/>
7272
</actionGroup>
73-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
74-
<waitForPageLoad stepKey="waitForAdminOrderPageLoad"/>
73+
74+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
7575
<scrollTo selector="{{AdminOrderTotalSection.subTotal}}" stepKey="scrollToOrderTotalSection"/>
7676
<see selector="{{AdminOrderTotalSection.subTotal}}" userInput="$0.00" stepKey="checkSubtotal"/>
7777
</test>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@
199199
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="openOrdersGrid">
200200
<argument name="orderId" value="{$grabOrderNumber}"/>
201201
</actionGroup>
202-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
203-
<waitForPageLoad time="30" stepKey="waitForPageLoad10"/>
202+
203+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
204204

205205
<!-- Checking the correctness of displayed custom options for user parameters on Order -->
206206

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@
104104
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/>
105105
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/>
106106
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/>
107-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
108-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
107+
108+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
109109

110110
<!-- Checking the correctness of displayed custom options for user parameters on Order -->
111111

app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@
124124
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/>
125125
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
126126

127-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
128-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
127+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
129128
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/>
130129
<waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/>
131130
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderById">
8484
<argument name="orderId" value="$grabOrderNumber"/>
8585
</actionGroup>
86-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
87-
<waitForPageLoad stepKey="waitForAdminOrderPageLoad"/>
86+
87+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
8888
<scrollTo selector="{{AdminOrderTotalSection.grandTotal}}" stepKey="scrollToOrderTotalSection"/>
8989
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$$createProduct.price$$" stepKey="checkTotal"/>
9090
</test>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest/StorefrontGuestCheckoutTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
<fillField selector="{{AdminOrdersGridSection.search}}" userInput="{$grabOrderNumber}" stepKey="fillOrderNum"/>
6565
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearchOrderNum"/>
6666
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/>
67-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
68-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
67+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
6968
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeAdminOrderStatus"/>
7069
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.fullname}}" stepKey="seeAdminOrderGuest"/>
7170
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAdminOrderEmail"/>

app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById">
9494
<argument name="orderId" value="$grabOrderNumber"/>
9595
</actionGroup>
96-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
97-
<waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/>
96+
97+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
9898

9999
<!--Verify that Created order is in Processing status-->
100100
<see selector="{{AdminShipmentOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeShipmentOrderStatus"/>

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@
7070
<argument name="orderId" value="$grabOrderNumber"/>
7171
</actionGroup>
7272

73-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
74-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
73+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
7574
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
7675
<waitForPageLoad stepKey="waitForNewInvoicePageLoad"/>
7776
<fillField selector="{{AdminInvoiceItemsSection.qtyToInvoiceColumn}}" userInput="1" stepKey="ChangeQtyToInvoice"/>

app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<actionGroup ref="SearchAdminDataGridByKeywordActionGroup" stepKey="searchOrder">
110110
<argument name="keyword" value="$grabOrderNumber"/>
111111
</actionGroup>
112-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
112+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
113113
<!--Create Invoice-->
114114
<actionGroup ref="AdminCreateInvoiceActionGroup" stepKey="createInvoice"/>
115115
<!--Create shipping label-->
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="AdminOrderGridClickFirstRowActionGroup">
12+
<annotations>
13+
<description>Click on first row of Order Grid.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickFirstOrderRow"/>
17+
<waitForPageLoad stepKey="waitForOrderPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
<actionGroup ref="FilterOrderGridByIdActionGroup" stepKey="filterOrderGridById">
8282
<argument name="orderId" value="$grabOrderNumber"/>
8383
</actionGroup>
84-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
85-
<waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/>
84+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
8685
<actionGroup ref="GoToInvoiceIntoOrderActionGroup" stepKey="goToInvoiceIntoOrderPage"/>
8786
<fillField selector="{{AdminInvoiceItemsSection.qtyToInvoiceColumn}}" userInput="5" stepKey="ChangeQtyToInvoice"/>
8887
<click selector="{{AdminInvoiceItemsSection.updateQty}}" stepKey="updateQuantity"/>

app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@
6868
<click selector="{{AdminOrdersGridSection.submitSearch}}" stepKey="submitSearch"/>
6969
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
7070

71-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
72-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
71+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
7372
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoice"/>
7473
<waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/>
7574
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>

app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@
103103
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/>
104104

105105
<!-- Create invoice -->
106-
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
107-
<waitForPageLoad stepKey="waitForOrderPageToLoad"/>
106+
<actionGroup ref="AdminOrderGridClickFirstRowActionGroup" stepKey="clickOrderRow"/>
108107
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
109108
<waitForPageLoad stepKey="waitForNewInvoicePageToLoad"/>
110109
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>

app/code/Magento/Sitemap/Test/Unit/Model/ObserverTest.php

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Store\Model\App\Emulation;
1212

1313
/**
14-
* Class ObserverTest
14+
* Class for ObserverTest
1515
*
1616
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1717
*/
@@ -28,54 +28,55 @@ class ObserverTest extends \PHPUnit\Framework\TestCase
2828
private $observer;
2929

3030
/**
31-
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
31+
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit\Framework\MockObject\MockObject
3232
*/
3333
private $scopeConfigMock;
3434

3535
/**
36-
* @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
36+
* @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory|\PHPUnit\Framework\MockObject\MockObject
3737
*/
3838
private $collectionFactoryMock;
3939

4040
/**
41-
* @var \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection|\PHPUnit_Framework_MockObject_MockObject
41+
* @var \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection|\PHPUnit\Framework\MockObject\MockObject
4242
*/
4343
private $sitemapCollectionMock;
4444

4545
/**
46-
* @var \Magento\Sitemap\Model\Sitemap|\PHPUnit_Framework_MockObject_MockObject
46+
* @var \Magento\Sitemap\Model\Sitemap|\PHPUnit\Framework\MockObject\MockObject
4747
*/
4848
private $sitemapMock;
4949

5050
/**
51-
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
51+
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit\Framework\MockObject\MockObject
5252
*/
5353
private $objectManagerMock;
5454

5555
/**
56-
* @var Emulation|\PHPUnit_Framework_MockObject_MockObject
56+
* @var Emulation|\PHPUnit\Framework\MockObject\MockObject
5757
*/
5858
private $appEmulationMock;
5959

6060
/**
61-
* @var EmailNotification|\PHPUnit_Framework_MockObject_MockObject
61+
* @var EmailNotification|\PHPUnit\Framework\MockObject\MockObject
6262
*/
6363
private $emailNotificationMock;
6464

6565
protected function setUp()
6666
{
67-
$this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
68-
->getMock();
69-
$this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
70-
->getMock();
67+
$this->objectManagerMock = $this->createMock(
68+
\Magento\Framework\ObjectManagerInterface::class
69+
);
70+
$this->scopeConfigMock = $this->createMock(
71+
\Magento\Framework\App\Config\ScopeConfigInterface::class
72+
);
7173
$this->collectionFactoryMock = $this->getMockBuilder(
7274
\Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory::class
7375
)->disableOriginalConstructor()
7476
->setMethods(['create'])
7577
->getMock();
76-
$this->sitemapCollectionMock = $this->createPartialMock(
77-
\Magento\Sitemap\Model\ResourceModel\Sitemap\Collection::class,
78-
['getIterator']
78+
$this->sitemapCollectionMock = $this->createMock(
79+
\Magento\Sitemap\Model\ResourceModel\Sitemap\Collection::class
7980
);
8081
$this->sitemapMock = $this->createPartialMock(
8182
\Magento\Sitemap\Model\Sitemap::class,
@@ -130,6 +131,10 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
130131
)
131132
->willReturn('[email protected]');
132133

134+
$this->emailNotificationMock->expects($this->once())
135+
->method('sendErrors')
136+
->with([$exception]);
137+
133138
$this->observer->scheduledGenerateSitemaps();
134139
}
135140
}

0 commit comments

Comments
 (0)