@@ -114,20 +114,24 @@ public function testEnvOverridesForValidConfigKeys(array $config): void
114114 $ xml = new Varien_Simplexml_Config ();
115115 $ xml ->loadString ($ xmlStruct );
116116
117+
117118 $ loader = new Mage_Core_Helper_EnvironmentConfigLoader ();
118119 /** @phpstan-ignore method.internal */
119120 $ loader ->setEnvStore ([
120121 'OPENMAGE_CONFIG_OVERRIDE_ALLOWED ' => 1 ,
121122 $ config ['env_path ' ] => $ config ['value ' ],
122123 ]);
124+ Mage::unregister ('current_env_config ' );
123125 $ loader ->overrideEnvironment ($ xml );
124126
125127 $ configPath = $ config ['xml_path ' ];
126128 $ defaultValue = $ xmlDefault ->getNode ($ configPath );
127129 $ valueAfterOverride = $ xml ->getNode ($ configPath );
128130
129131 // assert
130- static ::assertNotSame ((string ) $ defaultValue , (string ) $ valueAfterOverride , 'Default value was not overridden. ' );
132+ $ expected = (string ) $ defaultValue ;
133+ $ actual = (string ) $ valueAfterOverride ;
134+ static ::assertNotSame ($ expected , $ actual , 'Default value was not overridden. ' );
131135 }
132136
133137 public function envOverridesCorrectConfigKeysDataProvider (): Generator
@@ -216,35 +220,36 @@ public function testAsArray(array $config): void
216220 'OPENMAGE_CONFIG_OVERRIDE_ALLOWED ' => 1 ,
217221 $ config ['env_path ' ] => 1 ,
218222 ]);
219- $ actual = $ loader ->getAsArray ($ config ['scope ' ]);
223+ $ store = $ config ['store ' ];
224+ $ actual = $ loader ->getAsArray ($ store );
220225 $ expected = $ config ['expected ' ];
221226 static ::assertSame ($ expected , $ actual );
222227 }
223228
224229 public function envAsArrayDataProvider (): Generator
225230 {
226- yield 'defaultScope ' => [
231+ yield 'default ' => [
227232 [
228233 'env_path ' => 'OPENMAGE_CONFIG__DEFAULT__GENERAL__STORE_INFORMATION__NAME ' ,
229- 'scope ' => 'default ' ,
234+ 'store ' => '' , // or ' default', which will be used internally, but this is how \Mage_Adminhtml_Model_Config_Data::_validate defines it
230235 'expected ' => [
231236 'general/store_information/name ' => 1 ,
232237 ],
233238 ],
234239 ];
235- yield 'storeScope ' => [
240+ yield 'store ' => [
236241 [
237242 'env_path ' => 'OPENMAGE_CONFIG__STORES__GERMAN__GENERAL__STORE_INFORMATION__NAME ' ,
238- 'scope ' => 'stores ' ,
243+ 'store ' => 'german ' ,
239244 'expected ' => [
240245 'general/store_information/name ' => 1 ,
241246 ],
242247 ],
243248 ];
244- yield 'invalidScope ' => [
249+ yield 'invalidStore ' => [
245250 [
246251 'env_path ' => '' ,
247- 'scope ' => 'foo ' ,
252+ 'store ' => 'foo ' ,
248253 'expected ' => [],
249254 ],
250255 ];
@@ -283,7 +288,7 @@ public function envHasPathDataProvider(): Generator
283288 yield 'hasPath store ' => [
284289 [
285290 'env_path ' => 'OPENMAGE_CONFIG__STORES__GERMAN__GENERAL__STORE_INFORMATION__NAME ' ,
286- 'xml_path ' => 'stores/general/store_information/name ' ,
291+ 'xml_path ' => 'stores/german/ general/store_information/name ' ,
287292 'expected ' => true ,
288293 ],
289294 ];
@@ -313,11 +318,14 @@ public function testEnvDoesNotOverrideForInvalidConfigKeys(array $config): void
313318 $ xml ->loadString ($ xmlStruct );
314319
315320 $ defaultValue = 'test_default ' ;
316- static ::assertSame ($ defaultValue , (string ) $ xml ->getNode (self ::XML_PATH_DEFAULT ));
321+ $ actual = (string ) $ xml ->getNode (self ::XML_PATH_DEFAULT );
322+ static ::assertSame ($ defaultValue , $ actual );
317323 $ defaultWebsiteValue = 'test_website ' ;
318- static ::assertSame ($ defaultWebsiteValue , (string ) $ xml ->getNode (self ::XML_PATH_WEBSITE ));
324+ $ actual = (string ) $ xml ->getNode (self ::XML_PATH_WEBSITE );
325+ static ::assertSame ($ defaultWebsiteValue , $ actual );
319326 $ defaultStoreValue = 'test_store ' ;
320- static ::assertSame ($ defaultStoreValue , (string ) $ xml ->getNode (self ::XML_PATH_STORE ));
327+ $ actual = (string ) $ xml ->getNode (self ::XML_PATH_STORE );
328+ static ::assertSame ($ defaultStoreValue , $ actual );
321329
322330 $ loader = new Mage_Core_Helper_EnvironmentConfigLoader ();
323331 /** @phpstan-ignore method.internal */
0 commit comments