@@ -114,20 +114,24 @@ public function testEnvOverridesForValidConfigKeys(array $config): void
114
114
$ xml = new Varien_Simplexml_Config ();
115
115
$ xml ->loadString ($ xmlStruct );
116
116
117
+
117
118
$ loader = new Mage_Core_Helper_EnvironmentConfigLoader ();
118
119
/** @phpstan-ignore method.internal */
119
120
$ loader ->setEnvStore ([
120
121
'OPENMAGE_CONFIG_OVERRIDE_ALLOWED ' => 1 ,
121
122
$ config ['env_path ' ] => $ config ['value ' ],
122
123
]);
124
+ Mage::unregister ('current_env_config ' );
123
125
$ loader ->overrideEnvironment ($ xml );
124
126
125
127
$ configPath = $ config ['xml_path ' ];
126
128
$ defaultValue = $ xmlDefault ->getNode ($ configPath );
127
129
$ valueAfterOverride = $ xml ->getNode ($ configPath );
128
130
129
131
// 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. ' );
131
135
}
132
136
133
137
public function envOverridesCorrectConfigKeysDataProvider (): Generator
@@ -216,35 +220,36 @@ public function testAsArray(array $config): void
216
220
'OPENMAGE_CONFIG_OVERRIDE_ALLOWED ' => 1 ,
217
221
$ config ['env_path ' ] => 1 ,
218
222
]);
219
- $ actual = $ loader ->getAsArray ($ config ['scope ' ]);
223
+ $ store = $ config ['store ' ];
224
+ $ actual = $ loader ->getAsArray ($ store );
220
225
$ expected = $ config ['expected ' ];
221
226
static ::assertSame ($ expected , $ actual );
222
227
}
223
228
224
229
public function envAsArrayDataProvider (): Generator
225
230
{
226
- yield 'defaultScope ' => [
231
+ yield 'default ' => [
227
232
[
228
233
'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
230
235
'expected ' => [
231
236
'general/store_information/name ' => 1 ,
232
237
],
233
238
],
234
239
];
235
- yield 'storeScope ' => [
240
+ yield 'store ' => [
236
241
[
237
242
'env_path ' => 'OPENMAGE_CONFIG__STORES__GERMAN__GENERAL__STORE_INFORMATION__NAME ' ,
238
- 'scope ' => 'stores ' ,
243
+ 'store ' => 'german ' ,
239
244
'expected ' => [
240
245
'general/store_information/name ' => 1 ,
241
246
],
242
247
],
243
248
];
244
- yield 'invalidScope ' => [
249
+ yield 'invalidStore ' => [
245
250
[
246
251
'env_path ' => '' ,
247
- 'scope ' => 'foo ' ,
252
+ 'store ' => 'foo ' ,
248
253
'expected ' => [],
249
254
],
250
255
];
@@ -283,7 +288,7 @@ public function envHasPathDataProvider(): Generator
283
288
yield 'hasPath store ' => [
284
289
[
285
290
'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 ' ,
287
292
'expected ' => true ,
288
293
],
289
294
];
@@ -313,11 +318,14 @@ public function testEnvDoesNotOverrideForInvalidConfigKeys(array $config): void
313
318
$ xml ->loadString ($ xmlStruct );
314
319
315
320
$ 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 );
317
323
$ 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 );
319
326
$ 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 );
321
329
322
330
$ loader = new Mage_Core_Helper_EnvironmentConfigLoader ();
323
331
/** @phpstan-ignore method.internal */
0 commit comments