File tree 1 file changed +38
-0
lines changed
tests/unit/Mage/Core/Helper
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,44 @@ public function envOverridesCorrectConfigKeysDataProvider(): Generator
208
208
]];
209
209
}
210
210
211
+ /**
212
+ * @runInSeparateProcess
213
+ * @dataProvider envHasPathDataProvider
214
+ * @group Mage_Core
215
+ *
216
+ * @param array<string, string> $config
217
+ */
218
+ public function testHasPath (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 ->hasPath ($ config ['xml_path ' ]);
227
+ $ expected = $ config ['expected ' ];
228
+ $ this ->assertSame ($ expected , $ actual );
229
+ }
230
+
231
+ public function envHasPathDataProvider (): Generator
232
+ {
233
+ yield 'hasPath ' => [
234
+ [
235
+ 'env_path ' => 'OPENMAGE_CONFIG__DEFAULT__GENERAL__STORE_INFORMATION__NAME ' ,
236
+ 'xml_path ' => 'default/general/store_information/name ' ,
237
+ 'expected ' => true ,
238
+ ]
239
+ ];
240
+ yield 'hasNotPath ' => [
241
+ [
242
+ 'env_path ' => 'OPENMAGE_CONFIG__DEFAULT__GENERAL__STORE_INFORMATION__NAME ' ,
243
+ 'xml_path ' => 'foo/foo/foo ' ,
244
+ 'expected ' => false ,
245
+ ]
246
+ ];
247
+ }
248
+
211
249
/**
212
250
* @runInSeparateProcess
213
251
* @dataProvider envDoesNotOverrideOnWrongConfigKeysDataProvider
You can’t perform that action at this time.
0 commit comments