Skip to content

Commit 0287723

Browse files
authored
Merge branch '2.4-develop' into fix-for-issue-24730
2 parents 182a65c + 3bcbd95 commit 0287723

File tree

84 files changed

+2041
-244
lines changed

Some content is hidden

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

84 files changed

+2041
-244
lines changed

app/code/Magento/Catalog/Helper/Product/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function initProductLayout(ResultPage $resultPage, $product, $params = nu
193193
$resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku], $handle);
194194
}
195195
}
196-
196+
197197
$resultPage->addPageLayoutHandles(['type' => $product->getTypeId()], null, false);
198198
$resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku]);
199199

app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@
127127
<waitForPageLoad stepKey="waitForCustomersPage"/>
128128
<see userInput="You saved the customer." stepKey="CustomerIsSaved"/>
129129

130-
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
131-
<waitForPageLoad stepKey="waitForPageLoad1" />
130+
<actionGroup ref="AdminOpenCustomersGridActionGroup" stepKey="navigateToCustomers"/>
132131
<click selector="{{AdminCustomerFiltersSection.clearAll}}" stepKey="ClearFilters"/>
133132
<waitForPageLoad stepKey="waitForFiltersClear"/>
134133

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232
</item>
3333
<item name="children" xsi:type="array">
3434
<item name="errors" xsi:type="array">
35-
<item name="sortOrder" xsi:type="string">0</item>
3635
<item name="component" xsi:type="string">Magento_Ui/js/view/messages</item>
3736
<item name="displayArea" xsi:type="string">messages</item>
3837
</item>
3938
<item name="authentication" xsi:type="array">
40-
<item name="sortOrder" xsi:type="string">1</item>
4139
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication</item>
4240
<item name="displayArea" xsi:type="string">authentication</item>
4341
<item name="children" xsi:type="array">
@@ -50,7 +48,6 @@
5048
</item>
5149
</item>
5250
<item name="progressBar" xsi:type="array">
53-
<item name="sortOrder" xsi:type="string">0</item>
5451
<item name="component" xsi:type="string">Magento_Checkout/js/view/progress-bar</item>
5552
<item name="displayArea" xsi:type="string">progressBar</item>
5653
<item name="config" xsi:type="array">
@@ -61,7 +58,6 @@
6158
</item>
6259
</item>
6360
<item name="estimation" xsi:type="array">
64-
<item name="sortOrder" xsi:type="string">10</item>
6561
<item name="component" xsi:type="string">Magento_Checkout/js/view/estimation</item>
6662
<item name="displayArea" xsi:type="string">estimation</item>
6763
<item name="config" xsi:type="array">
@@ -335,7 +331,6 @@
335331
</item>
336332
</item>
337333
<item name="sidebar" xsi:type="array">
338-
<item name="sortOrder" xsi:type="string">50</item>
339334
<item name="component" xsi:type="string">Magento_Checkout/js/view/sidebar</item>
340335
<item name="displayArea" xsi:type="string">sidebar</item>
341336
<item name="config" xsi:type="array">
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminOpenCmsBlocksGridActionGroup">
12+
<annotations>
13+
<description>Goes to the Cms Blocks grid page.</description>
14+
</annotations>
15+
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSBlocksGrid"/>
16+
<waitForPageLoad stepKey="waitForPageLoad"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminPressAddNewCmsBlockButtonActionGroup">
12+
<annotations>
13+
<description>Press Add new block button on Cms Blocks gid page</description>
14+
</annotations>
15+
16+
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="clickOnAddNewBlockButton"/>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminPressSaveCmsBlockButtonActionGroup">
12+
<annotations>
13+
<description>Press save button on Cms Block page</description>
14+
</annotations>
15+
16+
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="clickOnSaveBlock"/>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AdminSelectCMSBlockStoreViewActionGroup">
12+
<arguments>
13+
<argument name="storeViewName" type="string"/>
14+
</arguments>
15+
16+
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/>
17+
</actionGroup>
18+
</actionGroups>
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="AssertAdminProperUrlIsShownActionGroup">
12+
<annotations>
13+
<description>Assert current page has proper URL</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="target_path" type="string"/>
17+
</arguments>
18+
19+
<seeInCurrentUrl url="{{target_path}}" stepKey="seePropertUrl"/>
20+
</actionGroup>
21+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
</annotations>
2222

2323
<before>
24-
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
25-
24+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2625
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
2726
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
2827
<argument name="websiteCode" value="{{customWebsite.code}}"/>
@@ -39,49 +38,60 @@
3938
</before>
4039

4140
<after>
42-
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite">
41+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
4342
<argument name="websiteName" value="{{customWebsite.name}}"/>
4443
</actionGroup>
45-
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="DeleteCMSBlockActionGroup"/>
44+
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="deleteCMSBlock"/>
45+
<actionGroup ref="DeleteCMSBlockActionGroup" stepKey="deleteSecondCMSBlock"/>
4646
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearFilters"/>
47+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
4748
</after>
4849

4950
<!--Go to Cms blocks page-->
50-
<amOnPage url="{{CmsBlocksPage.url}}" stepKey="navigateToCMSPagesGrid"/>
51-
<waitForPageLoad stepKey="waitForPageLoad1"/>
52-
<seeInCurrentUrl url="cms/block/" stepKey="VerifyPageIsOpened"/>
51+
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="navigateToCMSBlocksGrid"/>
52+
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="verifyPageIsOpened">
53+
<argument name="target_path" value="cms/block/"/>
54+
</actionGroup>
55+
5356
<!--Click to create new block-->
54-
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock"/>
55-
<waitForPageLoad stepKey="waitForPageLoad2"/>
56-
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened"/>
57+
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="clickOnAddNewBlockButton"/>
58+
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="verifyNewCmsBlockPageIsOpened">
59+
<argument name="target_path" value="cms/block/new"/>
60+
</actionGroup>
5761
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent"/>
58-
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock"/>
59-
<waitForPageLoad stepKey="waitForPageLoad3"/>
60-
<see userInput="You saved the block." stepKey="VerifyBlockIsSaved"/>
61-
<!--Click to go back and add new block-->
62-
<click selector="{{BlockNewPagePageActionsSection.back}}" stepKey="ClickToGoBack"/>
63-
<waitForPageLoad stepKey="waitForPageLoad4"/>
64-
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock1"/>
65-
<waitForPageLoad stepKey="waitForPageLoad5"/>
66-
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened1"/>
62+
<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="saveCmsBlock"/>
63+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertSuccessMessage">
64+
<argument name="message" value="You saved the block."/>
65+
</actionGroup>
66+
6767
<!--Add new BLock with the same data-->
68+
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="openCmsBlocksGrid"/>
69+
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="pressAddNewBlockButton"/>
70+
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="assertNewCmsBlockPageIsOpened">
71+
<argument name="target_path" value="cms/block/new"/>
72+
</actionGroup>
6873
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent1"/>
69-
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock1"/>
70-
<waitForPageLoad stepKey="waitForPageLoad6"/>
71-
<!--Verify that corresponding message is displayed-->
72-
<see userInput="A block identifier with the same properties already exists in the selected store." stepKey="VerifyBlockIsSaved1"/>
73-
<!--Click to go back and add new block-->
74-
<click selector="{{BlockNewPagePageActionsSection.back}}" stepKey="ClickToGoBack1"/>
75-
<waitForPageLoad stepKey="waitForPageLoad7"/>
76-
<click selector="{{BlockPageActionsSection.addNewBlock}}" stepKey="ClickToAddNewBlock2"/>
77-
<waitForPageLoad stepKey="waitForPageLoad8"/>
78-
<seeInCurrentUrl url="cms/block/new" stepKey="VerifyNewBlockPageIsOpened2"/>
74+
<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="clickOnSaveButton"/>
75+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="assertErrorMessage">
76+
<argument name="messageType" value="error"/>
77+
<argument name="message" value="A block identifier with the same properties already exists in the selected store."/>
78+
</actionGroup>
79+
7980
<!--Add new BLock with the same data for another store view-->
81+
<actionGroup ref="AdminOpenCmsBlocksGridActionGroup" stepKey="goToCmsBlocksGrid"/>
82+
<actionGroup ref="AdminPressAddNewCmsBlockButtonActionGroup" stepKey="clickToAddNewButton"/>
83+
<actionGroup ref="AssertAdminProperUrlIsShownActionGroup" stepKey="confirmNewCmsBlockPageIsOpened">
84+
<argument name="target_path" value="cms/block/new"/>
85+
</actionGroup>
8086
<actionGroup ref="FillOutBlockContent" stepKey="FillOutBlockContent2"/>
81-
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="Default Store View" stepKey="selectDefaultStoreView" />
82-
<selectOption selector="{{BlockNewPageBasicFieldsSection.storeView}}" userInput="{{customStore.name}}" stepKey="selectSecondStoreView1" />
83-
<click selector="{{BlockNewPagePageActionsSection.saveBlock}}" stepKey="ClickToSaveBlock2"/>
84-
<waitForPageLoad stepKey="waitForPageLoad9"/>
85-
<see userInput="You saved the block." stepKey="VerifyBlockIsSaved2"/>
87+
88+
<actionGroup ref="AdminSelectCMSBlockStoreViewActionGroup" stepKey="selectCustomStoreView">
89+
<argument name="storeViewName" value="{{customStore.name}}"/>
90+
</actionGroup>
91+
92+
<actionGroup ref="AdminPressSaveCmsBlockButtonActionGroup" stepKey="saveNewCmsBlock"/>
93+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="verifyBlockIsSaved">
94+
<argument name="message" value="You saved the block."/>
95+
</actionGroup>
8696
</test>
8797
</tests>

app/code/Magento/Config/Model/Config/Backend/Serialized.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Config\Model\Config\Backend;
77

8+
use Magento\Framework\App\Config\ScopeConfigInterface;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Serialize\Serializer\Json;
1011

@@ -84,4 +85,26 @@ public function beforeSave()
8485
parent::beforeSave();
8586
return $this;
8687
}
88+
89+
/**
90+
* Get old value from existing config
91+
*
92+
* @return string
93+
*/
94+
public function getOldValue()
95+
{
96+
// If the value is retrieved from defaults defined in config.xml
97+
// it may be returned as an array.
98+
$value = $this->_config->getValue(
99+
$this->getPath(),
100+
$this->getScope() ?: ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
101+
$this->getScopeCode()
102+
);
103+
104+
if (is_array($value)) {
105+
return $this->serializer->serialize($value);
106+
}
107+
108+
return (string)$value;
109+
}
87110
}

app/code/Magento/Config/Test/Unit/Model/Config/Backend/SerializedTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Config\Test\Unit\Model\Config\Backend;
99

1010
use Magento\Config\Model\Config\Backend\Serialized;
11+
use Magento\Framework\App\Config\ScopeConfigInterface;
1112
use Magento\Framework\Event\ManagerInterface;
1213
use Magento\Framework\Model\Context;
1314
use Magento\Framework\Serialize\Serializer\Json;
@@ -27,11 +28,14 @@ class SerializedTest extends TestCase
2728
/** @var LoggerInterface|MockObject */
2829
private $loggerMock;
2930

31+
private $scopeConfigMock;
32+
3033
protected function setUp(): void
3134
{
3235
$objectManager = new ObjectManager($this);
3336
$this->serializerMock = $this->createMock(Json::class);
3437
$this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);
38+
$this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
3539
$contextMock = $this->createMock(Context::class);
3640
$eventManagerMock = $this->getMockForAbstractClass(ManagerInterface::class);
3741
$contextMock->method('getEventDispatcher')
@@ -43,6 +47,7 @@ protected function setUp(): void
4347
[
4448
'serializer' => $this->serializerMock,
4549
'context' => $contextMock,
50+
'config' => $this->scopeConfigMock,
4651
]
4752
);
4853
}
@@ -135,4 +140,29 @@ public function beforeSaveDataProvider()
135140
]
136141
];
137142
}
143+
144+
/**
145+
* If a config value is not available in core_confid_data the defaults are
146+
* loaded from the config.xml file. Those defaults may be arrays.
147+
* The Serialized backend model has to override its parent
148+
* getOldValue function, to prevent an array to string conversion error
149+
* and serialize those values.
150+
*/
151+
public function testGetOldValueWithNonScalarDefaultValue(): void
152+
{
153+
$value = [
154+
['foo' => '1', 'bar' => '2'],
155+
];
156+
$serializedValue = \json_encode($value);
157+
158+
$this->scopeConfigMock->method('getValue')->willReturn($value);
159+
$this->serializerMock->method('serialize')->willReturn($serializedValue);
160+
161+
$this->serializedConfig->setData('value', $serializedValue);
162+
163+
$oldValue = $this->serializedConfig->getOldValue();
164+
165+
$this->assertIsString($oldValue, 'Default value from the config is not serialized.');
166+
$this->assertSame($serializedValue, $oldValue);
167+
}
138168
}

app/code/Magento/ConfigurableProduct/Helper/Data.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
namespace Magento\ConfigurableProduct\Helper;
88

99
use Magento\Catalog\Model\Product\Image\UrlBuilder;
10+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
1011
use Magento\Framework\App\ObjectManager;
1112
use Magento\Catalog\Helper\Image as ImageHelper;
1213
use Magento\Catalog\Api\Data\ProductInterface;
14+
use Magento\Catalog\Model\Product;
1315
use Magento\Catalog\Model\Product\Image;
1416

1517
/**
@@ -73,7 +75,7 @@ public function getGalleryImages(ProductInterface $product)
7375
/**
7476
* Get Options for Configurable Product Options
7577
*
76-
* @param \Magento\Catalog\Model\Product $currentProduct
78+
* @param Product $currentProduct
7779
* @param array $allowedProducts
7880
* @return array
7981
*/
@@ -100,11 +102,13 @@ public function getOptions($currentProduct, $allowedProducts)
100102
/**
101103
* Get allowed attributes
102104
*
103-
* @param \Magento\Catalog\Model\Product $product
105+
* @param Product $product
104106
* @return array
105107
*/
106108
public function getAllowAttributes($product)
107109
{
108-
return $product->getTypeInstance()->getConfigurableAttributes($product);
110+
return ($product->getTypeId() == Configurable::TYPE_CODE)
111+
? $product->getTypeInstance()->getConfigurableAttributes($product)
112+
: [];
109113
}
110114
}

0 commit comments

Comments
 (0)