Skip to content

Commit 15b5c60

Browse files
authored
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop expedited
Accepted Community Pull Requests: - #26413: #895 Fix for Media Gallery buttons are shifted to the left (by @diazwatson) - #26162: Fixed Issue with tier price 0 when saving product second time (by @ravi-chandra3197) - #26420: #8691: improved language pack inheritance order (by @sergiy-v) Fixed GitHub Issues: - #25195: Issue with tier price 0 when saving product second time (reported by @keyurshah070) has been fixed in #26162 by @ravi-chandra3197 in 2.4-develop branch Related commits: 1. ffab78e 2. ee152fc 3. 918fd02 4. f309ae0 - #8691: Language pack inheritance order is incorrect (reported by @koenner01) has been fixed in #26420 by @sergiy-v in 2.4-develop branch Related commits: 1. 8ce0822 2. 51ddad3 3. 0237c02 4. c42ebc1
2 parents 6df825a + 5ac85a6 commit 15b5c60

File tree

36 files changed

+447
-44
lines changed

36 files changed

+447
-44
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool
129129
{
130130
$isChanged = false;
131131
foreach ($valuesToUpdate as $key => $value) {
132-
if ((!empty($value['value'])
132+
if ((($value['value'])!== null
133133
&& (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value'])
134134
) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value)
135135
) {

app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php

Lines changed: 116 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
namespace Magento\Catalog\Test\Unit\Model\Attribute\Backend\TierPrice;
99

10-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
11-
use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler;
12-
use Magento\Store\Model\StoreManagerInterface;
1310
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
11+
use Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler;
12+
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
1413
use Magento\Customer\Api\GroupManagementInterface;
1514
use Magento\Framework\EntityManager\MetadataPool;
16-
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
15+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
16+
use Magento\Store\Model\StoreManagerInterface;
1717

1818
/**
1919
* Unit tests for \Magento\Catalog\Model\Product\Attribute\Backend\TierPrice\UpdateHandler
@@ -95,20 +95,27 @@ protected function setUp()
9595
);
9696
}
9797

98-
public function testExecute(): void
99-
{
100-
$newTierPrices = [
101-
['website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 15],
102-
['website_id' => 0, 'price_qty' => 3, 'cust_group' => 3200, 'price' => null, 'percentage_value' => 20]
103-
];
104-
$priceIdToDelete = 2;
105-
$originalTierPrices = [
106-
['price_id' => 1, 'website_id' => 0, 'price_qty' => 2, 'cust_group' => 0, 'price' => 10],
107-
['price_id' => $priceIdToDelete, 'website_id' => 0, 'price_qty' => 4, 'cust_group' => 0, 'price' => 20],
108-
];
109-
$linkField = 'entity_id';
110-
$productId = 10;
111-
$originalProductId = 11;
98+
/**
99+
* Verify update handle.
100+
*
101+
* @param array $newTierPrices
102+
* @param array $originalTierPrices
103+
* @param int $priceIdToDelete
104+
* @param string $linkField
105+
* @param int $productId
106+
* @param int $originalProductId
107+
* @throws \Magento\Framework\Exception\InputException
108+
*
109+
* @dataProvider configDataProvider
110+
*/
111+
public function testExecute(
112+
$newTierPrices,
113+
$originalTierPrices,
114+
$priceIdToDelete,
115+
$linkField,
116+
$productId,
117+
$originalProductId
118+
): void {
112119

113120
/** @var \PHPUnit_Framework_MockObject_MockObject $product */
114121
$product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class)
@@ -128,8 +135,12 @@ public function testExecute(): void
128135
['entity_id', $originalProductId]
129136
]
130137
);
138+
131139
$product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0);
132-
$product->expects($this->atLeastOnce())->method('setData')->with('tier_price_changed', 1);
140+
141+
$product->expects($this->atLeastOnce())
142+
->method('setData')
143+
->with('tier_price_changed', 1);
133144
$store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
134145
->disableOriginalConstructor()
135146
->setMethods(['getWebsiteId'])
@@ -163,11 +174,12 @@ public function testExecute(): void
163174
$this->tierPriceResource->expects($this->exactly(2))->method('savePriceData')->willReturnSelf();
164175
$this->tierPriceResource->expects($this->once())->method('deletePriceData')
165176
->with($productId, null, $priceIdToDelete);
166-
167177
$this->assertEquals($product, $this->updateHandler->execute($product));
168178
}
169179

170180
/**
181+
* Verify update handle with exception.
182+
*
171183
* @expectedException \Magento\Framework\Exception\InputException
172184
* @expectedExceptionMessage Tier prices data should be array, but actually other type is received
173185
*/
@@ -190,4 +202,88 @@ public function testExecuteWithException(): void
190202

191203
$this->updateHandler->execute($product);
192204
}
205+
206+
/**
207+
* Returns test parameters.
208+
*
209+
* @return array
210+
*/
211+
public function configDataProvider()
212+
{
213+
return [
214+
[
215+
[
216+
[
217+
'website_id' => 0,
218+
'price_qty' => 2,
219+
'cust_group' => 0,
220+
'price' => 15
221+
],
222+
[
223+
'website_id' => 0,
224+
'price_qty' => 3,
225+
'cust_group' => 3200,
226+
'price' => null,
227+
'percentage_value' => 20
228+
]
229+
],
230+
[
231+
[
232+
'price_id' => 1,
233+
'website_id' => 0,
234+
'price_qty' => 2,
235+
'cust_group' => 0,
236+
'price' => 10],
237+
[
238+
'price_id' => 2,
239+
'website_id' => 0,
240+
'price_qty' => 4,
241+
'cust_group' => 0,
242+
'price' => 20
243+
],
244+
],
245+
2,
246+
'entity_id',
247+
10,
248+
11
249+
],
250+
[
251+
[
252+
[
253+
'website_id' => 0,
254+
'price_qty' => 2,
255+
'cust_group' => 0,
256+
'price' => 0
257+
],
258+
[
259+
'website_id' => 0,
260+
'price_qty' => 3,
261+
'cust_group' => 3200,
262+
'price' => null,
263+
'percentage_value' => 20
264+
]
265+
],
266+
[
267+
[
268+
'price_id' => 1,
269+
'website_id' => 0,
270+
'price_qty' => 2,
271+
'cust_group' => 0,
272+
'price' => 10
273+
],
274+
[
275+
'price_id' => 2,
276+
'website_id' => 0,
277+
'price_qty' => 4,
278+
'cust_group' => 0,
279+
'price' => 20
280+
],
281+
],
282+
2,
283+
'entity_id',
284+
10,
285+
11
286+
]
287+
];
288+
}
193289
}

app/design/adminhtml/Magento/backend/Magento_Cms/web/css/source/_module.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
.media-gallery-modal {
77
.page-main-actions {
88
margin-bottom: 3rem;
9+
10+
.page-action-buttons {
11+
text-align: right;
12+
}
913
}
1014

1115
.new_folder {

dev/tests/integration/testsuite/Magento/Framework/App/Language/DictionaryTest.php

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public function dictionaryDataProvider()
6363
// Second case with inheritance of package with the same language code
6464
'a case with inheritance similar language code' => $this->getDataInheritanceWitSimilarCode(),
6565
// Third case with circular inheritance, when two packages depend on each other
66-
'a case with circular inheritance' => $this->getDataCircularInheritance()
66+
'a case with circular inheritance' => $this->getDataCircularInheritance(),
67+
// Fourth case with multiple inheritance from dev docs
68+
'a case with multiple inheritance from dev docs' => $this->getDataMultipleInheritanceFromDevDocs()
6769
];
6870
}
6971

@@ -113,7 +115,7 @@ private function getDataCircularInheritance()
113115
{
114116
return [
115117
// Dictionary that will be requested
116-
'language_code' => 'en_US',
118+
'language_code' => 'en_AZ',
117119
// Expected merged dictionary data
118120
'expectation' => [
119121
'one' => '1.0',
@@ -123,4 +125,48 @@ private function getDataCircularInheritance()
123125
]
124126
];
125127
}
128+
129+
/**
130+
* If a language package inherits from two packages:
131+
* ...
132+
* <code>en_AK</code>
133+
* ...
134+
* <use vendor="parent-package-one" package="language_package_one"/>
135+
* <use vendor= "parent-package-two" package="language_package_two"/>
136+
* ...
137+
*
138+
* In the preceding example:
139+
* language_package_one inherits from en_au_package and en_au_package inherits from en_ie_package
140+
* language_package_two inherits from en_ca_package and en_ca_package inherits from en_us_package
141+
*
142+
* If the Magento application cannot find word or phrase in the en_AK package,
143+
* it looks in other packages in following sequence:
144+
* parent-package-one/language_package_one
145+
* <vendorname>/en_au_package
146+
* <vendorname>/en_ie_package
147+
* parent-package-two/language_package_two
148+
* <vendorname>/en_ca_package
149+
* <vendorname>/en_us_package
150+
*
151+
* @return array
152+
*/
153+
private function getDataMultipleInheritanceFromDevDocs()
154+
{
155+
return [
156+
// Dictionary that will be requested
157+
'language_code' => 'en_AK',
158+
// Expected merged dictionary data
159+
'expectation' => [
160+
'one' => 'en_us_package_one',
161+
'two' => 'en_ca_package_two',
162+
'three' => 'language_package_two_three',
163+
'four' => 'en_ie_package_four',
164+
'five' => 'en_au_package_five',
165+
'six' => 'language_package_one_six',
166+
'seven' => 'en_ak_seven',
167+
'eight' => 'en_ak_eight',
168+
'nine' => 'en_ak_nine',
169+
]
170+
];
171+
}
126172
}

dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/language.xml renamed to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/language.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
-->
88
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
9-
<code>en_US</code>
9+
<code>en_AZ</code>
1010
<vendor>bar</vendor>
11-
<package>en_us</package>
11+
<package>en_az</package>
1212
<sort_order>0</sort_order>
1313
</language>

dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php renamed to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_az/registration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
use Magento\Framework\Component\ComponentRegistrar;
88

9-
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_us', __DIR__);
9+
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_az', __DIR__);

dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/language.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
<vendor>bar</vendor>
1111
<package>en_gb</package>
1212
<sort_order>100</sort_order>
13-
<use package="en_us" vendor="bar"/>
13+
<use package="en_az" vendor="bar"/>
1414
</language>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
four and 5/10,4.5
1+
one,1.00
2+
two,2.00
3+
three,3.00
4+
four,4.00
5+
four and 5/10,4.5
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
seven,en_ak_seven
2+
eight,en_ak_eight
3+
nine,en_ak_nine
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
9+
<code>en_AK</code>
10+
<vendor>devdoc</vendor>
11+
<package>en_ak</package>
12+
<sort_order>0</sort_order>
13+
<use vendor="parent-package-one" package="language_package_one"/>
14+
<use vendor="parent-package-two" package="language_package_two"/>
15+
</language>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'devdoc_en_ak', __DIR__);

dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/language.xml renamed to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/language.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77
-->
88
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
9-
<code>en_US</code>
9+
<code>en_AZ</code>
1010
<vendor>first</vendor>
11-
<package>en_us</package>
11+
<package>en_az</package>
1212
<sort_order>0</sort_order>
1313
<use package="en_gb" vendor="second"/>
1414
</language>

dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php renamed to dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_az/registration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
use Magento\Framework\Component\ComponentRegistrar;
88

9-
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_us', __DIR__);
9+
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_az', __DIR__);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
five,en_au_package_five
2+
six,en_au_package_six
3+
seven,en_au_package_seven
4+
eight,en_au_package_eight
5+
nine,en_au_package_nine
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
9+
<code>en_US</code>
10+
<vendor>parent-package-one</vendor>
11+
<package>en_au_package</package>
12+
<sort_order>0</sort_order>
13+
<use vendor="parent-package-one" package="en_ie_package"/>
14+
</language>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'parent-package-one_en_au_package', __DIR__);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
four,en_ie_package_four
2+
five,en_ie_package_five
3+
six,en_ie_package_six
4+
seven,en_ie_package_seven
5+
eight,en_ie_package_eight
6+
nine,en_ie_package_nine
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
9+
<code>en_US</code>
10+
<vendor>parent-package-one</vendor>
11+
<package>en_ie_package</package>
12+
<sort_order>0</sort_order>
13+
</language>

0 commit comments

Comments
 (0)