Skip to content

Commit 44ec111

Browse files
authored
Merge branch '2.4-develop' into poison-pill
2 parents 4f5303d + 2b943ed commit 44ec111

File tree

57 files changed

+1740
-246
lines changed

Some content is hidden

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

57 files changed

+1740
-246
lines changed

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/EavAttributeCondition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public function build(Filter $filter): string
6464
->select()
6565
->from(
6666
[Collection::MAIN_TABLE_ALIAS => $entityResourceModel->getEntityTable()],
67-
Collection::MAIN_TABLE_ALIAS . '.' . $entityResourceModel->getEntityIdField()
67+
Collection::MAIN_TABLE_ALIAS . '.' . $attribute->getEntityIdField()
6868
)->joinLeft(
6969
[$tableAlias => $attribute->getBackendTable()],
7070
$tableAlias . '.' . $attribute->getEntityIdField() . '=' . Collection::MAIN_TABLE_ALIAS .
71-
'.' . $entityResourceModel->getEntityIdField() . ' AND ' . $tableAlias . '.' .
71+
'.' . $attribute->getEntityIdField() . ' AND ' . $tableAlias . '.' .
7272
$attribute->getIdFieldName() . '=' . $attribute->getAttributeId(),
7373
''
7474
)->where($tableAlias . '.value is null');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Api\ProductLinkRepositoryInterface;
12+
use Magento\Catalog\Model\Indexer\Product\Full as FullProductIndexer;
13+
14+
/**
15+
* Product reindexing after delete by id links plugin.
16+
*/
17+
class ReindexAfterDeleteByIdProductLinksPlugin
18+
{
19+
/**
20+
* @var FullProductIndexer
21+
*/
22+
private $fullProductIndexer;
23+
24+
/**
25+
* @var ProductRepositoryInterface
26+
*/
27+
private $productRepository;
28+
29+
/**
30+
* @param FullProductIndexer $fullProductIndexer
31+
* @param ProductRepositoryInterface $productRepository
32+
*/
33+
public function __construct(FullProductIndexer $fullProductIndexer, ProductRepositoryInterface $productRepository)
34+
{
35+
$this->fullProductIndexer = $fullProductIndexer;
36+
$this->productRepository = $productRepository;
37+
}
38+
39+
/**
40+
* Complex reindex after product links has been deleted.
41+
*
42+
* @param ProductLinkRepositoryInterface $subject
43+
* @param bool $result
44+
* @param string $sku
45+
* @param string $type
46+
* @param string $linkedProductSku
47+
* @return bool
48+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
49+
*/
50+
public function afterDeleteById(ProductLinkRepositoryInterface $subject, bool $result, $sku): bool
51+
{
52+
$product = $this->productRepository->get($sku);
53+
$this->fullProductIndexer->executeRow($product->getId());
54+
55+
return $result;
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Api\ProductLinkRepositoryInterface;
12+
use Magento\Catalog\Api\Data\ProductLinkInterface;
13+
use Magento\Catalog\Model\Indexer\Product\Full as FullProductIndexer;
14+
15+
/**
16+
* Product reindexing after save links plugin.
17+
*/
18+
class ReindexAfterSaveProductLinksPlugin
19+
{
20+
/**
21+
* @var FullProductIndexer
22+
*/
23+
private $fullProductIndexer;
24+
25+
/**
26+
* @var ProductRepositoryInterface
27+
*/
28+
private $productRepository;
29+
30+
/**
31+
* @param FullProductIndexer $fullProductIndexer
32+
* @param ProductRepositoryInterface $productRepository
33+
*/
34+
public function __construct(FullProductIndexer $fullProductIndexer, ProductRepositoryInterface $productRepository)
35+
{
36+
$this->fullProductIndexer = $fullProductIndexer;
37+
$this->productRepository = $productRepository;
38+
}
39+
40+
/**
41+
* Complex reindex after product links has been saved.
42+
*
43+
* @param ProductLinkRepositoryInterface $subject
44+
* @param bool $result
45+
* @param ProductLinkInterface $entity
46+
* @return bool
47+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
48+
*/
49+
public function afterSave(ProductLinkRepositoryInterface $subject, bool $result, ProductLinkInterface $entity): bool
50+
{
51+
$product = $this->productRepository->get($entity->getSku());
52+
$this->fullProductIndexer->executeRow($product->getId());
53+
54+
return $result;
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="StorefrontAssertRelatedProductOnProductPageActionGroup">
12+
<annotations>
13+
<description>Validates that the provided Product Name is present on Product details page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
17+
</arguments>
18+
19+
<waitForElementVisible selector="{{StorefrontProductRelatedProductsSection.relatedProductsListSectionText}}" stepKey="waitForRelatedProductsList"/>
20+
<see selector="{{StorefrontProductRelatedProductsSection.relatedProductsListSectionText}}" userInput="{{productName}}" stepKey="seeRelatedProduct"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest/AdvanceCatalogSearchSimpleProductByShortDescriptionTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<group value="Catalog"/>
1919
</annotations>
2020
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
22+
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/>
2123
<createData entity="ApiProductWithDescription" stepKey="product"/>
2224
</before>
2325
<after>

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Store\Model\StoreManagerInterface;
2222
use Magento\Store\Model\Website;
2323
use PHPUnit\Framework\MockObject\MockObject;
24+
use PHPUnit\Framework\MockObject\RuntimeException;
2425
use PHPUnit\Framework\TestCase;
2526

2627
/**
@@ -110,7 +111,7 @@ protected function setUp(): void
110111
$this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')
111112
->willReturn($group);
112113
$this->tierPriceExtensionFactoryMock = $this->getMockBuilder(ProductTierPriceExtensionFactory::class)
113-
->setMethods(['create'])
114+
->onlyMethods(['create'])
114115
->disableOriginalConstructor()
115116
->getMock();
116117
$this->model = $this->objectManagerHelper->getObject(
@@ -182,9 +183,7 @@ function () {
182183
);
183184

184185
// create sample TierPrice objects that would be coming from a REST call
185-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
186-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
187-
->getMockForAbstractClass();
186+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
188187
$tierPriceExtensionMock->expects($this->any())->method('getWebsiteId')->willReturn($expectedWebsiteId);
189188
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(null);
190189
$tp1 = $this->objectManagerHelper->getObject(TierPrice::class);
@@ -226,9 +225,7 @@ function () {
226225
$this->assertEquals($tps[$i]->getQty(), $tpData['price_qty'], 'Qty does not match');
227226
}
228227

229-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
230-
->setMethods(['getWebsiteId', 'setWebsiteId', 'getPercentageValue', 'setPercentageValue'])
231-
->getMockForAbstractClass();
228+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
232229
$tierPriceExtensionMock->expects($this->any())->method('getPercentageValue')->willReturn(50);
233230
$tierPriceExtensionMock->expects($this->any())->method('setWebsiteId');
234231
$this->tierPriceExtensionFactoryMock->expects($this->any())
@@ -289,14 +286,30 @@ function () {
289286
return $this->objectManagerHelper->getObject(TierPrice::class);
290287
}
291288
);
292-
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
293-
->onlyMethods(['getPercentageValue', 'setPercentageValue'])
294-
->getMockForAbstractClass();
289+
$tierPriceExtensionMock = $this->getProductTierPriceExtensionInterfaceMock();
295290
$tierPriceExtensionMock->method('getPercentageValue')
296291
->willReturn(50);
297292
$this->tierPriceExtensionFactoryMock->method('create')
298293
->willReturn($tierPriceExtensionMock);
299294

300295
$this->assertInstanceOf(TierPrice::class, $this->model->getTierPrices($this->product)[0]);
301296
}
297+
298+
/**
299+
* Build ProductTierPriceExtensionInterface mock.
300+
*
301+
* @return MockObject
302+
*/
303+
private function getProductTierPriceExtensionInterfaceMock(): MockObject
304+
{
305+
$mockBuilder = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
306+
->disableOriginalConstructor();
307+
try {
308+
$mockBuilder->addMethods(['getPercentageValue', 'setPercentageValue', 'setWebsiteId', 'getWebsiteId']);
309+
} catch (RuntimeException $e) {
310+
// ProductTierPriceExtensionInterface already generated and has all necessary methods.
311+
}
312+
313+
return $mockBuilder->getMock();
314+
}
302315
}

app/code/Magento/Catalog/etc/webapi_rest/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@
4040
<argument name="deserializer" xsi:type="object">Magento\Catalog\Model\Product\Webapi\Rest\RequestTypeBasedDeserializer</argument>
4141
</arguments>
4242
</type>
43+
<type name="Magento\Catalog\Api\ProductLinkRepositoryInterface">
44+
<plugin name="reindex_after_save_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterSaveProductLinksPlugin"/>
45+
<plugin name="reindex_after_delete_by_id_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterDeleteByIdProductLinksPlugin"/>
46+
</type>
4347
</config>

app/code/Magento/Catalog/etc/webapi_soap/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@
4040
<argument name="deserializer" xsi:type="object">Magento\Framework\Webapi\Rest\Request\Deserializer\Xml</argument>
4141
</arguments>
4242
</type>
43+
<type name="Magento\Catalog\Api\ProductLinkRepositoryInterface">
44+
<plugin name="reindex_after_save_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterSaveProductLinksPlugin"/>
45+
<plugin name="reindex_after_delete_by_id_product_links" type="Magento\Catalog\Plugin\Api\ProductLinkRepositoryInterface\ReindexAfterDeleteByIdProductLinksPlugin"/>
46+
</type>
4347
</config>

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ define([
4747
* Initialize object
4848
*/
4949
initialize: function () {
50-
var self = this;
50+
var self = this,
51+
popupDialog = jQuery('#product_composite_configure');
5152

5253
this._initWindowElements();
5354
jQuery.async('#product_composite_configure', function (el) {
55+
if (el !== popupDialog[0]) {
56+
el = popupDialog[0];
57+
}
5458
self.dialog = jQuery(el).modal({
5559
title: jQuery.mage.__('Configure Product'),
5660
type: 'slide',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<requiredEntity createDataKey="createSimpleProduct"/>
4040
</createData>
4141
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
42-
<argument name="indices" value="cataloginventory_stock"/>
42+
<argument name="indices" value=""/>
4343
</actionGroup>
4444
</before>
4545
<after>

0 commit comments

Comments
 (0)