Skip to content

Commit 4bfb545

Browse files
committed
AC-6385:TypeError: explode(): Argument #2 ($string) must be of type string
1 parent 9034093 commit 4bfb545

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

app/code/Magento/Config/Controller/Adminhtml/System/Config/Save.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1010
use Magento\Config\Controller\Adminhtml\System\AbstractConfig;
11+
use Magento\Framework\Exception\LocalizedException;
1112

1213
/**
1314
* System Configuration Save Controller
@@ -221,6 +222,22 @@ public function execute()
221222
];
222223
$configData = $this->filterNodes($configData);
223224

225+
$europeanUnionCountriesSelectedValues = true;
226+
$fields = $configData['groups']['country']['fields'];
227+
if (isset($fields['eu_countries'])) {
228+
if (empty($fields['eu_countries']['value']) &&
229+
!isset($fields['eu_countries']['inherit'])) {
230+
$europeanUnionCountriesSelectedValues = false;
231+
}
232+
} else {
233+
$europeanUnionCountriesSelectedValues = false;
234+
}
235+
if (!$europeanUnionCountriesSelectedValues) {
236+
throw new LocalizedException(
237+
__('Something went wrong while saving this configuration.')
238+
);
239+
}
240+
224241
/** @var \Magento\Config\Model\Config $configModel */
225242
$configModel = $this->_configFactory->create(['data' => $configData]);
226243
$configModel->save();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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="EuropeanCountriesOptionActionGroup">
12+
<annotations>
13+
<description>Validate european country option value</description>
14+
</annotations>
15+
16+
<amOnPage url="{{AdminConfigGeneralPage.url}}" stepKey="navigateToAdminStoreConfiguration"/>
17+
<conditionalClick selector="{{CountriesFormSection.block}}" dependentSelector="{{CountriesFormSection.label}}" visible="false" stepKey="expand_panel"/>
18+
<scrollTo selector="{{CountriesFormSection.label}}" stepKey="scrolltolabel" />
19+
<wait time="2" stepKey="waitForLoad"/>
20+
<uncheckOption selector="{{CountriesFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/>
21+
<wait time="2" stepKey="waitForLoad1"/>
22+
<click selector="{{CountriesFormSection.saveConfig}}" stepKey="clickSave"/>
23+
</actionGroup>
24+
</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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="CountriesFormSection">
12+
<element name="optionvalue" type="select" selector='//*[@id="general_country_eu_countries"]'/>
13+
<element name="saveConfig" type="button" selector="#save" timeout="30"/>
14+
<element name="label" type="input" selector="#row_general_country_optional_zip_countries"/>
15+
<element name="useConfigSettings" type="checkbox" selector="//input[@name='groups[country][fields][eu_countries][inherit]']"/>
16+
<element name="block" type="button" selector='a#general_country-head'/>
17+
</section>
18+
</sections>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="ValidateEuropeanCountriesOptionValue">
11+
<annotations>
12+
<features value="Backend"/>
13+
<stories value="Check european countries option value"/>
14+
<title value="There must be atleast one european country selected"/>
15+
<description value="There must be atleast one european country selected"/>
16+
<severity value="CRITICAL"/>
17+
<group value="config"/>
18+
<testCaseId value="AC-6385"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
22+
<actionGroup ref="EuropeanCountriesOptionActionGroup" stepKey="validate"/>
23+
</before>
24+
<after>
25+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
26+
</after>
27+
</test>
28+
</tests>

0 commit comments

Comments
 (0)