File tree 1 file changed +40
-0
lines changed
tests/unit/Mage/Core/Helper
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,46 @@ public function envOverridesCorrectConfigKeysDataProvider(): Generator
208
208
]];
209
209
}
210
210
211
+ /**
212
+ * @runInSeparateProcess
213
+ * @dataProvider envAsArrayDataProvider
214
+ * @group Mage_Core
215
+ *
216
+ * @param array<string, string> $config
217
+ */
218
+ public function testAsArray (array $ config ): void
219
+ {
220
+ // phpcs:ignore Ecg.Classes.ObjectInstantiation.DirectInstantiation
221
+ $ loader = new Mage_Core_Helper_EnvironmentConfigLoader ();
222
+ $ loader ->setEnvStore ([
223
+ 'OPENMAGE_CONFIG_OVERRIDE_ALLOWED ' => 1 ,
224
+ $ config ['env_path ' ] => 1 ,
225
+ ]);
226
+ $ actual = $ loader ->getAsArray ($ config ['scope ' ]);
227
+ $ expected = $ config ['expected ' ];
228
+ $ this ->assertSame ($ expected , $ actual );
229
+ }
230
+
231
+ public function envAsArrayDataProvider (): Generator
232
+ {
233
+ yield 'defaultScope ' => [
234
+ [
235
+ 'env_path ' => 'OPENMAGE_CONFIG__DEFAULT__GENERAL__STORE_INFORMATION__NAME ' ,
236
+ 'scope ' => 'default ' ,
237
+ 'expected ' => [
238
+ 'general/store_information/name ' => 1 ,
239
+ ],
240
+ ]
241
+ ];
242
+ yield 'invalidScope ' => [
243
+ [
244
+ 'env_path ' => '' ,
245
+ 'scope ' => 'foo ' ,
246
+ 'expected ' => [],
247
+ ]
248
+ ];
249
+ }
250
+
211
251
/**
212
252
* @runInSeparateProcess
213
253
* @dataProvider envHasPathDataProvider
You can’t perform that action at this time.
0 commit comments