Skip to content

Commit c0dce8d

Browse files
merge magento/2.3-develop into magento-epam/EPAM-PR-30
2 parents 6812727 + 9c36f6f commit c0dce8d

File tree

57 files changed

+1928
-195
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

+1928
-195
lines changed

app/code/Magento/Braintree/view/adminhtml/templates/form/cc.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $ccType = $block->getInfoData('cc_type');
8383
id="<?= /* @noEscape */ $code ?>_vault"
8484
name="payment[is_active_payment_token_enabler]"
8585
class="admin__control-checkbox"/>
86-
<label class="label" for="<?= /* @noEscape */ $code ?>_vault">
86+
<label class="label admin__field-label" for="<?= /* @noEscape */ $code ?>_vault">
8787
<span><?= $block->escapeHtml(__('Save for later use.')) ?></span>
8888
</label>
8989
</div>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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\Bundle\Model\Plugin\Frontend;
9+
10+
use Magento\Bundle\Model\Product\Type;
11+
use Magento\Catalog\Model\Product as CatalogProduct;
12+
13+
/**
14+
* Add child identities to product identities on storefront.
15+
*/
16+
class Product
17+
{
18+
/**
19+
* @var Type
20+
*/
21+
private $type;
22+
23+
/**
24+
* @param Type $type
25+
*/
26+
public function __construct(Type $type)
27+
{
28+
$this->type = $type;
29+
}
30+
31+
/**
32+
* Add child identities to product identities
33+
*
34+
* @param CatalogProduct $product
35+
* @param array $identities
36+
* @return array
37+
*/
38+
public function afterGetIdentities(CatalogProduct $product, array $identities): array
39+
{
40+
foreach ($this->type->getChildrenIds($product->getEntityId()) as $childIds) {
41+
foreach ($childIds as $childId) {
42+
$identities[] = CatalogProduct::CACHE_TAG . '_' . $childId;
43+
}
44+
}
45+
46+
return array_unique($identities);
47+
}
48+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Unit\Model\Plugin\Frontend;
8+
9+
use Magento\Bundle\Model\Plugin\Frontend\Product as ProductPlugin;
10+
use Magento\Bundle\Model\Product\Type;
11+
use Magento\Catalog\Model\Product;
12+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
13+
14+
class ProductTest extends \PHPUnit\Framework\TestCase
15+
{
16+
/** @var \Magento\Bundle\Model\Plugin\Product */
17+
private $plugin;
18+
19+
/** @var MockObject|Type */
20+
private $type;
21+
22+
/** @var MockObject|\Magento\Catalog\Model\Product */
23+
private $product;
24+
25+
protected function setUp()
26+
{
27+
$this->product = $this->getMockBuilder(Product::class)
28+
->disableOriginalConstructor()
29+
->setMethods(['getEntityId'])
30+
->getMock();
31+
32+
$this->type = $this->getMockBuilder(Type::class)
33+
->disableOriginalConstructor()
34+
->setMethods(['getChildrenIds'])
35+
->getMock();
36+
37+
$this->plugin = new ProductPlugin($this->type);
38+
}
39+
40+
public function testAfterGetIdentities()
41+
{
42+
$baseIdentities = [
43+
'SomeCacheId',
44+
'AnotherCacheId',
45+
];
46+
$id = 12345;
47+
$childIds = [
48+
1 => [1, 2, 5, 100500],
49+
12 => [7, 22, 45, 24612]
50+
];
51+
$expectedIdentities = [
52+
'SomeCacheId',
53+
'AnotherCacheId',
54+
Product::CACHE_TAG . '_' . 1,
55+
Product::CACHE_TAG . '_' . 2,
56+
Product::CACHE_TAG . '_' . 5,
57+
Product::CACHE_TAG . '_' . 100500,
58+
Product::CACHE_TAG . '_' . 7,
59+
Product::CACHE_TAG . '_' . 22,
60+
Product::CACHE_TAG . '_' . 45,
61+
Product::CACHE_TAG . '_' . 24612,
62+
];
63+
$this->product->expects($this->once())
64+
->method('getEntityId')
65+
->will($this->returnValue($id));
66+
$this->type->expects($this->once())
67+
->method('getChildrenIds')
68+
->with($id)
69+
->will($this->returnValue($childIds));
70+
$identities = $this->plugin->afterGetIdentities($this->product, $baseIdentities);
71+
$this->assertEquals($expectedIdentities, $identities);
72+
}
73+
}

app/code/Magento/Bundle/etc/frontend/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
</argument>
1414
</arguments>
1515
</type>
16+
<type name="Magento\Catalog\Model\Product">
17+
<plugin name="bundle" type="Magento\Bundle\Model\Plugin\Frontend\Product" sortOrder="100" />
18+
</type>
1619
</config>

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ protected function _prepareColumns()
322322
}
323323

324324
/**
325-
* Rerieve grid URL
325+
* Retrieve grid URL
326326
*
327327
* @return string
328328
*/

app/code/Magento/Catalog/Model/Layer/Filter/Item/DataBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Catalog\Model\Layer\Filter\Item;
8+
79
/**
810
* Item Data Builder
911
*/
10-
namespace Magento\Catalog\Model\Layer\Filter\Item;
11-
1212
class DataBuilder
1313
{
1414
/**
@@ -29,7 +29,7 @@ class DataBuilder
2929
* Add Item Data
3030
*
3131
* @param string $label
32-
* @param string $label
32+
* @param string $value
3333
* @param int $count
3434
* @return void
3535
*/

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ define([
9191

9292
/**
9393
* Add product list types as scope and their urls
94-
* expamle: addListType('product_to_add', {urlFetch: 'http://magento...'})
95-
* expamle: addListType('wishlist', {urlSubmit: 'http://magento...'})
94+
* example: addListType('product_to_add', {urlFetch: 'http://magento...'})
95+
* example: addListType('wishlist', {urlSubmit: 'http://magento...'})
9696
*
9797
* @param type types as scope
9898
* @param urls obj can be
@@ -112,7 +112,7 @@ define([
112112
/**
113113
* Adds complex list type - that is used to submit several list types at once
114114
* Only urlSubmit is possible for this list type
115-
* expamle: addComplexListType(['wishlist', 'product_list'], 'http://magento...')
115+
* example: addComplexListType(['wishlist', 'product_list'], 'http://magento...')
116116
*
117117
* @param type types as scope
118118
* @param urls obj can be

app/code/Magento/Catalog/view/adminhtml/web/js/form/element/action-delete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
define([
66
'underscore',
77
'Magento_Ui/js/form/element/abstract'
8-
], function (_, Acstract) {
8+
], function (_, Abstract) {
99
'use strict';
1010

11-
return Acstract.extend({
11+
return Abstract.extend({
1212
defaults: {
1313
prefixName: '',
1414
prefixElementName: '',

app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
define([
66
'underscore',
77
'Magento_Ui/js/form/element/abstract'
8-
], function (_, Acstract) {
8+
], function (_, Abstract) {
99
'use strict';
1010

11-
return Acstract.extend({
11+
return Abstract.extend({
1212
defaults: {
1313
prefixName: '',
1414
prefixElementName: '',

app/code/Magento/Catalog/view/base/web/js/price-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ define([
6060
pattern = pattern.indexOf('{sign}') < 0 ? s + pattern : pattern.replace('{sign}', s);
6161

6262
// we're avoiding the usage of to fixed, and using round instead with the e representation to address
63-
// numbers like 1.005 = 1.01. Using ToFixed to only provide trailig zeroes in case we have a whole number
63+
// numbers like 1.005 = 1.01. Using ToFixed to only provide trailing zeroes in case we have a whole number
6464
i = parseInt(
6565
amount = Number(Math.round(Math.abs(+amount || 0) + 'e+' + precision) + ('e-' + precision)),
6666
10

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ public function move($fileName, $renameFileOff = false)
180180
}
181181

182182
$fileName = preg_replace('/[^a-z0-9\._-]+/i', '', $fileName);
183-
$filePath = $this->_directory->getRelativePath($filePath . $fileName);
183+
$relativePath = $this->_directory->getRelativePath($filePath . $fileName);
184184
$this->_directory->writeFile(
185-
$filePath,
185+
$relativePath,
186186
$read->readAll()
187187
);
188188
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@
7979

8080
<!--Verify New addresses in Customer's Address Book-->
8181
<amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToCustomerAddressBook"/>
82-
<see userInput="{{UK_Not_Default_Address.street[0]}} {{UK_Not_Default_Address.city}}, {{UK_Not_Default_Address.postcode}}"
83-
selector="{{StorefrontCustomerAddressesSection.addressesList}}" stepKey="checkNewAddresses"/>
82+
<see userInput="{{UK_Not_Default_Address.street[0]}}"
83+
selector="{{StorefrontCustomerAddressesSection.addressesList}}" stepKey="checkNewAddressesStreet"/>
84+
<see userInput="{{UK_Not_Default_Address.city}}"
85+
selector="{{StorefrontCustomerAddressesSection.addressesList}}" stepKey="checkNewAddressesCity"/>
86+
<see userInput="{{UK_Not_Default_Address.postcode}}"
87+
selector="{{StorefrontCustomerAddressesSection.addressesList}}" stepKey="checkNewAddressesPostcode"/>
8488
<!--Order review page has address that was created during checkout-->
8589
<amOnPage url="{{StorefrontCustomerOrderViewPage.url({$grabOrderNumber})}}" stepKey="goToOrderReviewPage"/>
8690
<see userInput="{{UK_Not_Default_Address.street[0]}} {{UK_Not_Default_Address.city}}, {{UK_Not_Default_Address.postcode}}"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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\ConfigurableProduct\Model\Plugin\Frontend;
9+
10+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
11+
use Magento\Catalog\Model\Product;
12+
13+
/**
14+
* Extender of product identities for child of configurable products
15+
*/
16+
class ProductIdentitiesExtender
17+
{
18+
/**
19+
* @var Configurable
20+
*/
21+
private $configurableType;
22+
23+
/**
24+
* @param Configurable $configurableType
25+
*/
26+
public function __construct(Configurable $configurableType)
27+
{
28+
$this->configurableType = $configurableType;
29+
}
30+
31+
/**
32+
* Add child identities to product identities
33+
*
34+
* @param Product $subject
35+
* @param array $identities
36+
* @return array
37+
*/
38+
public function afterGetIdentities(Product $subject, array $identities): array
39+
{
40+
foreach ($this->configurableType->getChildrenIds($subject->getId()) as $childIds) {
41+
foreach ($childIds as $childId) {
42+
$identities[] = Product::CACHE_TAG . '_' . $childId;
43+
}
44+
}
45+
46+
return array_unique($identities);
47+
}
48+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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\ConfigurableProduct\Test\Unit\Model\Plugin\Frontend;
9+
10+
use Magento\ConfigurableProduct\Model\Plugin\Frontend\ProductIdentitiesExtender;
11+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
12+
use Magento\Catalog\Model\Product;
13+
14+
/**
15+
* Class ProductIdentitiesExtenderTest
16+
*/
17+
class ProductIdentitiesExtenderTest extends \PHPUnit\Framework\TestCase
18+
{
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject|Configurable
21+
*/
22+
private $configurableTypeMock;
23+
24+
/**
25+
* @var ProductIdentitiesExtender
26+
*/
27+
private $plugin;
28+
29+
/** @var MockObject|\Magento\Catalog\Model\Product */
30+
private $product;
31+
32+
protected function setUp()
33+
{
34+
$this->product = $this->getMockBuilder(Product::class)
35+
->disableOriginalConstructor()
36+
->setMethods(['getId'])
37+
->getMock();
38+
39+
$this->configurableTypeMock = $this->getMockBuilder(Configurable::class)
40+
->disableOriginalConstructor()
41+
->getMock();
42+
43+
$this->plugin = new ProductIdentitiesExtender($this->configurableTypeMock);
44+
}
45+
46+
public function testAfterGetIdentities()
47+
{
48+
$identities = [
49+
'SomeCacheId',
50+
'AnotherCacheId',
51+
];
52+
$productId = 12345;
53+
$childIdentities = [
54+
0 => [1, 2, 5, 100500]
55+
];
56+
$expectedIdentities = [
57+
'SomeCacheId',
58+
'AnotherCacheId',
59+
Product::CACHE_TAG . '_' . 1,
60+
Product::CACHE_TAG . '_' . 2,
61+
Product::CACHE_TAG . '_' . 5,
62+
Product::CACHE_TAG . '_' . 100500,
63+
];
64+
65+
$this->product->expects($this->once())
66+
->method('getId')
67+
->willReturn($productId);
68+
69+
$this->configurableTypeMock->expects($this->once())
70+
->method('getChildrenIds')
71+
->with($productId)
72+
->willReturn($childIdentities);
73+
74+
$productIdentities = $this->plugin->afterGetIdentities($this->product, $identities);
75+
$this->assertEquals($expectedIdentities, $productIdentities);
76+
}
77+
}

app/code/Magento/ConfigurableProduct/etc/frontend/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010
<type name="Magento\ConfigurableProduct\Model\ResourceModel\Attribute\OptionSelectBuilderInterface">
1111
<plugin name="Magento_ConfigurableProduct_Plugin_Model_ResourceModel_Attribute_InStockOptionSelectBuilder" type="Magento\ConfigurableProduct\Plugin\Model\ResourceModel\Attribute\InStockOptionSelectBuilder"/>
1212
</type>
13+
<type name="Magento\Catalog\Model\Product">
14+
<plugin name="product_identities_extender" type="Magento\ConfigurableProduct\Model\Plugin\Frontend\ProductIdentitiesExtender" />
15+
</type>
1316
</config>

0 commit comments

Comments
 (0)