Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 2.3-develop into ENGCOM-4389-magento-magento2-21458
- Loading branch information
Showing
35 changed files
with
775 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/code/Magento/Catalog/Test/Mftf/Data/ProductLinkData.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="RelatedProductLink" type="product_link"> | ||
<var key="sku" entityKey="sku" entityType="product2"/> | ||
<var key="linked_product_sku" entityKey="sku" entityType="product"/> | ||
<data key="link_type">related</data> | ||
<data key="linked_product_type">simple</data> | ||
<data key="position">1</data> | ||
<requiredEntity type="product_link_extension_attribute">Qty1000</requiredEntity> | ||
</entity> | ||
</entities> |
14 changes: 14 additions & 0 deletions
14
app/code/Magento/Catalog/Test/Mftf/Data/ProductLinksData.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="OneRelatedProductLink" type="product_links"> | ||
<requiredEntity type="product_link">RelatedProductLink</requiredEntity> | ||
</entity> | ||
</entities> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> | ||
<entity name="ProductLinkWidget" extends="ProductsListWidget"> | ||
<data key="type">Catalog Product Link</data> | ||
<data key="template">Product Link Block Template</data> | ||
</entity> | ||
</entities> |
14 changes: 14 additions & 0 deletions
14
app/code/Magento/Catalog/Test/Mftf/Page/AdminNewWidgetPage.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> | ||
<page name="AdminNewWidgetPage" url="admin/widget_instance/new/" area="admin" module="Magento_Widget"> | ||
<section name="AdminNewWidgetSelectProductPopupSection"/> | ||
</page> | ||
</pages> |
14 changes: 14 additions & 0 deletions
14
app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="AdminNewWidgetSection"> | ||
<element name="selectProduct" type="button" selector=".btn-chooser" timeout="30"/> | ||
</section> | ||
</sections> |
15 changes: 15 additions & 0 deletions
15
app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSelectProductPopupSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="AdminNewWidgetSelectProductPopupSection"> | ||
<element name="filterBySku" type="input" selector=".data-grid-filters input[name='chooser_sku']"/> | ||
<element name="firstRow" type="select" selector=".even>td" timeout="20"/> | ||
</section> | ||
</sections> |
32 changes: 32 additions & 0 deletions
32
...o/CatalogInventory/Ui/DataProvider/Product/AddQuantityAndStockStatusFieldToCollection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogInventory\Ui\DataProvider\Product; | ||
|
||
use Magento\Framework\Data\Collection; | ||
use Magento\Ui\DataProvider\AddFieldToCollectionInterface; | ||
|
||
/** | ||
* Add quantity_and_stock_status field to collection | ||
*/ | ||
class AddQuantityAndStockStatusFieldToCollection implements AddFieldToCollectionInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function addField(Collection $collection, $field, $alias = null) | ||
{ | ||
$collection->joinField( | ||
'quantity_and_stock_status', | ||
'cataloginventory_stock_item', | ||
'is_in_stock', | ||
'product_id=entity_id', | ||
'{{table}}.stock_id=1', | ||
'left' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/code/Magento/Checkout/view/frontend/web/js/empty-cart.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
define([ | ||
'Magento_Customer/js/customer-data' | ||
], function (customerData) { | ||
'use strict'; | ||
|
||
var cartData = customerData.get('cart'); | ||
|
||
if (cartData().items && cartData().items.length !== 0) { | ||
customerData.reload(['cart'], false); | ||
} | ||
}); |
44 changes: 44 additions & 0 deletions
44
...ode/Magento/ConfigurableProduct/Plugin/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\ConfigurableProduct\Plugin\Tax\Model\Sales\Total\Quote; | ||
|
||
use Magento\ConfigurableProduct\Model\Product\Type\Configurable; | ||
use Magento\Quote\Model\Quote\Item\AbstractItem; | ||
use Magento\Tax\Api\Data\QuoteDetailsItemInterface; | ||
use Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory; | ||
|
||
/** | ||
* Plugin for CommonTaxCollector to apply Tax Class ID from child item for configurable product | ||
*/ | ||
class CommonTaxCollector | ||
{ | ||
/** | ||
* Apply Tax Class ID from child item for configurable product | ||
* | ||
* @param \Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector $subject | ||
* @param QuoteDetailsItemInterface $result | ||
* @param QuoteDetailsItemInterfaceFactory $itemDataObjectFactory | ||
* @param AbstractItem $item | ||
* @return QuoteDetailsItemInterface | ||
* | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function afterMapItem( | ||
\Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector $subject, | ||
QuoteDetailsItemInterface $result, | ||
QuoteDetailsItemInterfaceFactory $itemDataObjectFactory, | ||
AbstractItem $item | ||
) : QuoteDetailsItemInterface { | ||
if ($item->getProduct()->getTypeId() === Configurable::TYPE_CODE && $item->getHasChildren()) { | ||
$childItem = $item->getChildren()[0]; | ||
$result->getTaxClassKey()->setValue($childItem->getProduct()->getTaxClassId()); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...nfigurableProduct/Test/Unit/Plugin/Tax/Model/Sales/Total/Quote/CommonTaxCollectorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\ConfigurableProduct\Test\Unit\Plugin\Tax\Model\Sales\Total\Quote; | ||
|
||
use Magento\Catalog\Model\Product; | ||
use Magento\ConfigurableProduct\Model\Product\Type\Configurable; | ||
use Magento\ConfigurableProduct\Plugin\Tax\Model\Sales\Total\Quote\CommonTaxCollector as CommonTaxCollectorPlugin; | ||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; | ||
use Magento\Quote\Model\Quote\Item\AbstractItem; | ||
use Magento\Tax\Api\Data\QuoteDetailsItemInterface; | ||
use Magento\Tax\Api\Data\QuoteDetailsItemInterfaceFactory; | ||
use Magento\Tax\Api\Data\TaxClassKeyInterface; | ||
use Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
|
||
/** | ||
* Test for CommonTaxCollector plugin | ||
*/ | ||
class CommonTaxCollectorTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var ObjectManager | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var CommonTaxCollectorPlugin | ||
*/ | ||
private $commonTaxCollectorPlugin; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); | ||
$this->commonTaxCollectorPlugin = $this->objectManager->getObject(CommonTaxCollectorPlugin::class); | ||
} | ||
|
||
/** | ||
* Test to apply Tax Class Id from child item for configurable product | ||
*/ | ||
public function testAfterMapItem() | ||
{ | ||
$childTaxClassId = 10; | ||
|
||
/** @var Product|MockObject $childProductMock */ | ||
$childProductMock = $this->createPartialMock( | ||
Product::class, | ||
['getTaxClassId'] | ||
); | ||
$childProductMock->method('getTaxClassId')->willReturn($childTaxClassId); | ||
/* @var AbstractItem|MockObject $quoteItemMock */ | ||
$childQuoteItemMock = $this->createMock( | ||
AbstractItem::class | ||
); | ||
$childQuoteItemMock->method('getProduct')->willReturn($childProductMock); | ||
|
||
/** @var Product|MockObject $productMock */ | ||
$productMock = $this->createPartialMock( | ||
Product::class, | ||
['getTypeId'] | ||
); | ||
$productMock->method('getTypeId')->willReturn(Configurable::TYPE_CODE); | ||
/* @var AbstractItem|MockObject $quoteItemMock */ | ||
$quoteItemMock = $this->createPartialMock( | ||
AbstractItem::class, | ||
['getProduct', 'getHasChildren', 'getChildren', 'getQuote', 'getAddress', 'getOptionByCode'] | ||
); | ||
$quoteItemMock->method('getProduct')->willReturn($productMock); | ||
$quoteItemMock->method('getHasChildren')->willReturn(true); | ||
$quoteItemMock->method('getChildren')->willReturn([$childQuoteItemMock]); | ||
|
||
/* @var TaxClassKeyInterface|MockObject $taxClassObjectMock */ | ||
$taxClassObjectMock = $this->createMock(TaxClassKeyInterface::class); | ||
$taxClassObjectMock->expects($this->once())->method('setValue')->with($childTaxClassId); | ||
|
||
/* @var QuoteDetailsItemInterface|MockObject $quoteDetailsItemMock */ | ||
$quoteDetailsItemMock = $this->createMock(QuoteDetailsItemInterface::class); | ||
$quoteDetailsItemMock->method('getTaxClassKey')->willReturn($taxClassObjectMock); | ||
|
||
$this->commonTaxCollectorPlugin->afterMapItem( | ||
$this->createMock(CommonTaxCollector::class), | ||
$quoteDetailsItemMock, | ||
$this->createMock(QuoteDetailsItemInterfaceFactory::class), | ||
$quoteItemMock | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.