Skip to content

Commit 50fd0b6

Browse files
merge magento/2.4-develop into magento-performance/MC-36671
2 parents 42ac2e8 + 7198c76 commit 50fd0b6

File tree

28 files changed

+558
-615
lines changed

28 files changed

+558
-615
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,9 @@
6868
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="filterBundleProductOptionsDownToName">
6969
<argument name="product" value="BundleProduct"/>
7070
</actionGroup>
71-
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="SelectAllOnly1"/>
72-
<waitForPageLoad stepKey="loading2"/>
7371

7472
<!--Delete-->
75-
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="ClickOnActionsChangingView"/>
76-
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="ClickDelete"/>
77-
<click selector="//button[@class='action-primary action-accept']" stepKey="ConfirmDelete"/>
78-
<waitForPageLoad stepKey="loading3"/>
73+
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>
7974

8075
<!--Locating delete message-->
8176
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@
118118
<actionGroup ref="BundleProductFilter" stepKey="FilterForOnlyBundleProducts"/>
119119

120120
<!--Delete-->
121-
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="SelectAllOnly1"/>
122-
<waitForPageLoad stepKey="loading"/>
123-
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="ClickOnActionsChangingView"/>
124-
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="ClickDelete"/>
125-
<click selector="//button[@class='action-primary action-accept']" stepKey="ConfirmDelete"/>
126-
<waitForPageLoad stepKey="loading3"/>
121+
<actionGroup ref="AdminDeleteAllProductsFromGridActionGroup" stepKey="selectAndDeleteProducts"/>
127122

128123
<!--Locating delete message-->
129124
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="deleteMessage"/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminDeleteAllProductsFromGridActionGroup">
12+
<annotations>
13+
<description>Select and delete products in product grid.</description>
14+
</annotations>
15+
<click selector="{{AdminProductFiltersSection.allCheckbox}}" stepKey="selectAllProducts"/>
16+
<click selector="{{AdminProductFiltersSection.actions}}" stepKey="clickOnActionsChangingView"/>
17+
<click selector="{{AdminProductFiltersSection.delete}}" stepKey="clickDelete"/>
18+
<click selector="//button[@class='action-primary action-accept']" stepKey="confirmDelete"/>
19+
<waitForPageLoad stepKey="waitingProductGridLoad"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/CatalogImportExport/Test/Unit/Model/Export/ProductTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
namespace Magento\CatalogImportExport\Test\Unit\Model\Export;
99

1010
use Magento\Catalog\Model\Product\LinkTypeProvider;
11+
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
1112
use Magento\CatalogImportExport\Model\Export\Product;
1213
use Magento\CatalogImportExport\Model\Export\Product\Type\Factory;
1314
use Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite;
1415
use Magento\Eav\Model\Config;
1516
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
1617
use Magento\Eav\Model\Entity\Type;
18+
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory as AttributeSetCollectionFactory;
1719
use Magento\Framework\App\ResourceConnection;
1820
use Magento\Framework\EntityManager\MetadataPool;
1921
use Magento\Framework\Logger\Monolog;
@@ -83,7 +85,7 @@ class ProductTest extends TestCase
8385
protected $attrSetColFactory;
8486

8587
/**
86-
* @var \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory|MockObject
88+
* @var CategoryCollectionFactory|MockObject
8789
*/
8890
protected $categoryColFactory;
8991

@@ -174,15 +176,14 @@ protected function setUp(): void
174176
->onlyMethods(['create'])
175177
->getMock();
176178

177-
$this->attrSetColFactory = $this->getMockBuilder(
178-
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory::class
179-
)->addMethods(['setEntityTypeFilter'])
179+
$this->attrSetColFactory = $this->getMockBuilder(AttributeSetCollectionFactory::class)
180+
->disableOriginalConstructor()
181+
->addMethods(['setEntityTypeFilter'])
180182
->onlyMethods(['create'])
181183
->getMock();
182184

183-
$this->categoryColFactory = $this->getMockBuilder(
184-
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory::class
185-
)->addMethods(['addNameToResult'])
185+
$this->categoryColFactory = $this->getMockBuilder(CategoryCollectionFactory::class)
186+
->disableOriginalConstructor()->addMethods(['addNameToResult'])
186187
->onlyMethods(['create'])
187188
->getMock();
188189

app/code/Magento/CatalogInventory/Model/StockState.php

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
use Magento\CatalogInventory\Api\StockStateInterface;
1010
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
1111
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;
12+
use Magento\Framework\DataObject;
1213

1314
/**
15+
* Provides functionality for stock state information
16+
*
1417
* Interface StockState
1518
*/
1619
class StockState implements StockStateInterface
@@ -31,6 +34,8 @@ class StockState implements StockStateInterface
3134
protected $stockConfiguration;
3235

3336
/**
37+
* StockState constructor
38+
*
3439
* @param StockStateProviderInterface $stockStateProvider
3540
* @param StockRegistryProviderInterface $stockRegistryProvider
3641
* @param StockConfigurationInterface $stockConfiguration
@@ -46,30 +51,32 @@ public function __construct(
4651
}
4752

4853
/**
54+
* Verify stock by product id
55+
*
4956
* @param int $productId
5057
* @param int $scopeId
5158
* @return bool
5259
*/
5360
public function verifyStock($productId, $scopeId = null)
5461
{
55-
// if ($scopeId === null) {
56-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
57-
// }
62+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
5863
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
64+
5965
return $this->stockStateProvider->verifyStock($stockItem);
6066
}
6167

6268
/**
69+
* Verify notification by product id
70+
*
6371
* @param int $productId
6472
* @param int $scopeId
6573
* @return bool
6674
*/
6775
public function verifyNotification($productId, $scopeId = null)
6876
{
69-
// if ($scopeId === null) {
70-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
71-
// }
77+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
7278
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
79+
7380
return $this->stockStateProvider->verifyNotification($stockItem);
7481
}
7582

@@ -84,16 +91,14 @@ public function verifyNotification($productId, $scopeId = null)
8491
*/
8592
public function checkQty($productId, $qty, $scopeId = null)
8693
{
87-
// if ($scopeId === null) {
88-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
89-
// }
94+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
9095
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
96+
9197
return $this->stockStateProvider->checkQty($stockItem, $qty);
9298
}
9399

94100
/**
95-
* Returns suggested qty that satisfies qty increments and minQty/maxQty/minSaleQty/maxSaleQty conditions
96-
* or original qty if such value does not exist
101+
* Returns suggested qty that satisfies qty increments/minQty/maxQty/minSaleQty/maxSaleQty else returns original qty
97102
*
98103
* @param int $productId
99104
* @param float $qty
@@ -102,10 +107,9 @@ public function checkQty($productId, $qty, $scopeId = null)
102107
*/
103108
public function suggestQty($productId, $qty, $scopeId = null)
104109
{
105-
// if ($scopeId === null) {
106-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
107-
// }
110+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
108111
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
112+
109113
return $this->stockStateProvider->suggestQty($stockItem, $qty);
110114
}
111115

@@ -118,29 +122,31 @@ public function suggestQty($productId, $qty, $scopeId = null)
118122
*/
119123
public function getStockQty($productId, $scopeId = null)
120124
{
121-
// if ($scopeId === null) {
122-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
123-
// }
125+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
124126
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
127+
125128
return $this->stockStateProvider->getStockQty($stockItem);
126129
}
127130

128131
/**
132+
* Check qty increments by product id
133+
*
129134
* @param int $productId
130135
* @param float $qty
131136
* @param int $websiteId
132-
* @return \Magento\Framework\DataObject
137+
* @return DataObject
133138
*/
134139
public function checkQtyIncrements($productId, $qty, $websiteId = null)
135140
{
136-
// if ($websiteId === null) {
137-
$websiteId = $this->stockConfiguration->getDefaultScopeId();
138-
// }
141+
$websiteId = $this->stockConfiguration->getDefaultScopeId();
139142
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $websiteId);
143+
140144
return $this->stockStateProvider->checkQtyIncrements($stockItem, $qty);
141145
}
142146

143147
/**
148+
* Check quote item qty
149+
*
144150
* @param int $productId
145151
* @param float $itemQty
146152
* @param float $qtyToCheck
@@ -150,10 +156,9 @@ public function checkQtyIncrements($productId, $qty, $websiteId = null)
150156
*/
151157
public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $scopeId = null)
152158
{
153-
// if ($scopeId === null) {
154-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
155-
// }
159+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
156160
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
161+
157162
return $this->stockStateProvider->checkQuoteItemQty($stockItem, $itemQty, $qtyToCheck, $origQty);
158163
}
159164
}

app/code/Magento/Developer/Test/Unit/Console/Command/XmlCatalogGenerateCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testExecuteBadType()
4646
->with(
4747
$this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]),
4848
$this->equalTo('test')
49-
)->willReturn(null);
49+
);
5050

5151
$formats = ['phpstorm' => $phpstormFormatMock];
5252
$readFactory = $this->createMock(ReadFactory::class);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<argument name="entityType" xsi:type="string">catalog_category</argument>
2525
</arguments>
2626
</virtualType>
27-
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
27+
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
2828
<arguments>
2929
<argument name="contentTypes" xsi:type="array">
3030
<item name="catalog_category" xsi:type="array">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<argument name="entityType" xsi:type="string">cms_block</argument>
2525
</arguments>
2626
</virtualType>
27-
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
27+
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
2828
<arguments>
2929
<argument name="contentTypes" xsi:type="array">
3030
<item name="cms_block" xsi:type="array">

0 commit comments

Comments
 (0)