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