@@ -26,26 +26,30 @@ public function testValidConfig(array $inputConfig, array $expectedConfig): void
26
26
/**
27
27
* @param mixed $value
28
28
*
29
- * @dataProvider dataTestSettingsDynamicChecker
29
+ * @dataProvider dataTestSettingsDynamicCheckerInvalid
30
30
*/
31
- public function testSettingsDynamicChecker ($ value, bool $ passed ): void
31
+ public function testSettingsDynamicCheckerInvalid ($ value ): void
32
32
{
33
- if (!$ passed ) {
34
- $ this ->assertConfigurationIsInvalid ([
35
- 'meilisearch ' => [
36
- 'indices ' => [
37
- [
38
- 'name ' => 'items ' ,
39
- 'class ' => 'App\Entity\Post ' ,
40
- 'settings ' => $ value ,
41
- ],
33
+ $ this ->assertConfigurationIsInvalid ([
34
+ 'meilisearch ' => [
35
+ 'indices ' => [
36
+ [
37
+ 'name ' => 'items ' ,
38
+ 'class ' => 'App\Entity\Post ' ,
39
+ 'settings ' => $ value ,
42
40
],
43
41
],
44
- ], 'Settings must be an array. ' );
45
-
46
- return ;
47
- }
42
+ ],
43
+ ], 'Settings must be an array. ' );
44
+ }
48
45
46
+ /**
47
+ * @param mixed $value
48
+ *
49
+ * @dataProvider dataTestSettingsDynamicCheckerValid
50
+ */
51
+ public function testSettingsDynamicCheckerValid ($ value ): void
52
+ {
49
53
$ this ->assertConfigurationIsValid ([
50
54
'meilisearch ' => [
51
55
'indices ' => [
@@ -330,31 +334,32 @@ public static function dataTestConfigurationTree(): iterable
330
334
];
331
335
}
332
336
333
- public static function dataTestSettingsDynamicChecker (): iterable
337
+ public static function dataTestSettingsDynamicCheckerInvalid (): iterable
334
338
{
335
339
yield 'string is not acceptable ' => [
336
- 'settings ' => 'hello ' ,
337
- 'passed ' => false ,
340
+ 'value ' => 'hello '
338
341
];
339
-
340
342
yield 'int is not acceptable ' => [
341
- 'settings ' => 1 ,
342
- 'passed ' => false ,
343
+ 'value ' => 1
343
344
];
344
-
345
345
yield 'bool is not acceptable ' => [
346
- 'settings ' => true ,
347
- 'passed ' => false ,
346
+ 'value ' => true
348
347
];
348
+ }
349
349
350
+ public static function dataTestSettingsDynamicCheckerValid (): iterable
351
+ {
350
352
yield 'array is acceptable ' => [
351
- 'settings ' => [],
352
- 'passed ' => true ,
353
+ 'value ' => []
354
+ ];
355
+ yield 'array with arbitrary key is acceptable ' => [
356
+ 'value ' => [
357
+ 'key ' => 'value ' ,
358
+ 'key2 ' => 'value2 ' ,
359
+ ]
353
360
];
354
-
355
361
yield 'null is acceptable ' => [
356
- 'settings ' => null ,
357
- 'passed ' => true ,
362
+ 'value ' => null
358
363
];
359
364
}
360
365
0 commit comments