File tree 4 files changed +87
-0
lines changed
Controller/Adminhtml/System/Config 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 8
8
9
9
use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
10
10
use Magento \Config \Controller \Adminhtml \System \AbstractConfig ;
11
+ use Magento \Framework \Exception \LocalizedException ;
11
12
12
13
/**
13
14
* System Configuration Save Controller
@@ -221,6 +222,22 @@ public function execute()
221
222
];
222
223
$ configData = $ this ->filterNodes ($ configData );
223
224
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
+
224
241
/** @var \Magento\Config\Model\Config $configModel */
225
242
$ configModel = $ this ->_configFactory ->create (['data ' => $ configData ]);
226
243
$ configModel ->save ();
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments