Skip to content

Commit 6ee27c1

Browse files
merge magento/2.4-develop into magento-performance/MC-33086-catalog-event
2 parents 9dc6c62 + c4a7d77 commit 6ee27c1

File tree

47 files changed

+639
-436
lines changed

Some content is hidden

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

47 files changed

+639
-436
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/Config/App/Config/Source/RuntimeConfigSource.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
use Magento\Framework\App\Config\ConfigSourceInterface;
99
use Magento\Framework\App\Config\ScopeCodeResolver;
1010
use Magento\Framework\App\Config\ScopeConfigInterface;
11+
use Magento\Framework\App\DeploymentConfig;
12+
use Magento\Framework\App\ObjectManager;
1113
use Magento\Framework\DataObject;
1214
use Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory;
1315
use Magento\Framework\App\Config\Scope\Converter;
16+
use Magento\Framework\DB\Adapter\TableNotFoundException;
1417

1518
/**
1619
* Class for retrieving runtime configuration from database.
@@ -34,20 +37,27 @@ class RuntimeConfigSource implements ConfigSourceInterface
3437
* @var ScopeCodeResolver
3538
*/
3639
private $scopeCodeResolver;
40+
/**
41+
* @var DeploymentConfig
42+
*/
43+
private $deploymentConfig;
3744

3845
/**
3946
* @param CollectionFactory $collectionFactory
4047
* @param ScopeCodeResolver $scopeCodeResolver
4148
* @param Converter $converter
49+
* @param DeploymentConfig|null $deploymentConfig
4250
*/
4351
public function __construct(
4452
CollectionFactory $collectionFactory,
4553
ScopeCodeResolver $scopeCodeResolver,
46-
Converter $converter
54+
Converter $converter,
55+
?DeploymentConfig $deploymentConfig = null
4756
) {
4857
$this->collectionFactory = $collectionFactory;
4958
$this->converter = $converter;
5059
$this->scopeCodeResolver = $scopeCodeResolver;
60+
$this->deploymentConfig = $deploymentConfig ?? ObjectManager::getInstance()->get(DeploymentConfig::class);
5161
}
5262

5363
/**
@@ -59,7 +69,7 @@ public function __construct(
5969
*/
6070
public function get($path = '')
6171
{
62-
$data = new DataObject($this->loadConfig());
72+
$data = new DataObject($this->deploymentConfig->isDbAvailable() ? $this->loadConfig() : []);
6373
return $data->getData($path) ?: [];
6474
}
6575

@@ -75,8 +85,12 @@ private function loadConfig()
7585
{
7686
try {
7787
$collection = $this->collectionFactory->create();
88+
$collection->load();
7889
} catch (\DomainException $e) {
7990
$collection = [];
91+
} catch (TableNotFoundException $exception) {
92+
// database is empty or not setup
93+
$collection = [];
8094
}
8195
$config = [];
8296
foreach ($collection as $item) {

app/code/Magento/Config/Test/Unit/App/Config/Source/RuntimeConfigSourceTest.php

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,57 @@
55
*/
66
namespace Magento\Config\Test\Unit\App\Config\Source;
77

8+
use ArrayIterator;
89
use Magento\Config\App\Config\Source\RuntimeConfigSource;
10+
use Magento\Config\Model\ResourceModel\Config\Data\Collection;
911
use Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory;
1012
use Magento\Framework\App\Config\Scope\Converter;
1113
use Magento\Framework\App\Config\ScopeCodeResolver;
1214
use Magento\Framework\App\Config\ScopeConfigInterface;
1315
use Magento\Framework\App\Config\Value;
16+
use Magento\Framework\App\DeploymentConfig;
17+
use Magento\Framework\DB\Adapter\TableNotFoundException;
18+
use PHPUnit\Framework\MockObject\MockObject;
19+
use PHPUnit\Framework\TestCase;
1420

1521
/**
1622
* Test Class for retrieving runtime configuration from database.
17-
* @package Magento\Config\Test\Unit\App\Config\Source
1823
*/
19-
class RuntimeConfigSourceTest extends \PHPUnit\Framework\TestCase
24+
class RuntimeConfigSourceTest extends TestCase
2025
{
2126
/**
22-
* @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
27+
* @var CollectionFactory|MockObject
2328
*/
2429
private $collectionFactory;
2530

2631
/**
27-
* @var ScopeCodeResolver|\PHPUnit_Framework_MockObject_MockObject
32+
* @var ScopeCodeResolver|MockObject
2833
*/
2934
private $scopeCodeResolver;
3035

3136
/**
32-
* @var Converter|\PHPUnit_Framework_MockObject_MockObject
37+
* @var Converter|MockObject
3338
*/
3439
private $converter;
3540

3641
/**
37-
* @var Value|\PHPUnit_Framework_MockObject_MockObject
42+
* @var Value|MockObject
3843
*/
3944
private $configItem;
4045

4146
/**
42-
* @var Value|\PHPUnit_Framework_MockObject_MockObject
47+
* @var Value|MockObject
4348
*/
4449
private $configItemTwo;
4550

4651
/**
4752
* @var RuntimeConfigSource
4853
*/
4954
private $configSource;
55+
/**
56+
* @var DeploymentConfig|MockObject
57+
*/
58+
private $deploymentConfig;
5059

5160
public function setUp()
5261
{
@@ -68,20 +77,29 @@ public function setUp()
6877
->disableOriginalConstructor()
6978
->setMethods(['getScope', 'getPath', 'getValue', 'getScopeId'])
7079
->getMock();
80+
$this->deploymentConfig = $this->createPartialMock(DeploymentConfig::class, ['isDbAvailable']);
7181
$this->configSource = new RuntimeConfigSource(
7282
$this->collectionFactory,
7383
$this->scopeCodeResolver,
74-
$this->converter
84+
$this->converter,
85+
$this->deploymentConfig
7586
);
7687
}
7788

7889
public function testGet()
7990
{
91+
$this->deploymentConfig->method('isDbAvailable')
92+
->willReturn(true);
93+
$collection = $this->createPartialMock(Collection::class, ['load', 'getIterator']);
94+
$collection->method('load')
95+
->willReturn($collection);
96+
$collection->method('getIterator')
97+
->willReturn(new ArrayIterator([$this->configItem, $this->configItemTwo]));
8098
$scope = 'websites';
8199
$scopeCode = 'myWebsites';
82100
$this->collectionFactory->expects($this->once())
83101
->method('create')
84-
->willReturn([$this->configItem, $this->configItemTwo]);
102+
->willReturn($collection);
85103
$this->configItem->expects($this->exactly(2))
86104
->method('getScope')
87105
->willReturn(ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
@@ -133,4 +151,22 @@ public function testGet()
133151
$this->configSource->get()
134152
);
135153
}
154+
155+
public function testGetWhenDbIsNotAvailable()
156+
{
157+
$this->deploymentConfig->method('isDbAvailable')->willReturn(false);
158+
$this->assertEquals([], $this->configSource->get());
159+
}
160+
161+
public function testGetWhenDbIsEmpty()
162+
{
163+
$this->deploymentConfig->method('isDbAvailable')
164+
->willReturn(true);
165+
$collection = $this->createPartialMock(Collection::class, ['load']);
166+
$collection->method('load')
167+
->willThrowException($this->createMock(TableNotFoundException::class));
168+
$this->collectionFactory->method('create')
169+
->willReturn($collection);
170+
$this->assertEquals([], $this->configSource->get());
171+
}
136172
}

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-->

0 commit comments

Comments
 (0)