@@ -290,20 +290,26 @@ public static function providePermitEmpty(): iterable
290290 }
291291
292292 /**
293- * @dataProvider provideMatchesCases
293+ * @dataProvider provideMatches
294294 */
295295 public function testMatches (array $ data , bool $ expected ): void
296296 {
297297 $ this ->validation ->setRules (['foo ' => 'matches[bar] ' ]);
298298 $ this ->assertSame ($ expected , $ this ->validation ->run ($ data ));
299299 }
300300
301- public static function provideMatchesCases (): iterable
301+ public static function provideMatches (): iterable
302302 {
303303 yield from [
304- [['foo ' => null , 'bar ' => null ], true ],
305- [['foo ' => 'match ' , 'bar ' => 'match ' ], true ],
306- [['foo ' => 'match ' , 'bar ' => 'nope ' ], false ],
304+ 'foo bar not exist ' => [[], false ],
305+ 'bar not exist ' => [['foo ' => null ], false ],
306+ 'foo not exist ' => [['bar ' => null ], false ],
307+ 'foo bar null ' => [['foo ' => null , 'bar ' => null ], false ], // Strict Rule: true
308+ 'foo bar string match ' => [['foo ' => 'match ' , 'bar ' => 'match ' ], true ],
309+ 'foo bar string not match ' => [['foo ' => 'match ' , 'bar ' => 'nope ' ], false ],
310+ 'foo bar float match ' => [['foo ' => 1.2 , 'bar ' => 1.2 ], true ],
311+ 'foo bar float not match ' => [['foo ' => 1.2 , 'bar ' => 2.3 ], false ],
312+ 'foo bar bool match ' => [['foo ' => true , 'bar ' => true ], true ],
307313 ];
308314 }
309315
@@ -325,12 +331,27 @@ public static function provideMatchesNestedCases(): iterable
325331 }
326332
327333 /**
328- * @dataProvider provideMatchesCases
334+ * @dataProvider provideDiffers
329335 */
330336 public function testDiffers (array $ data , bool $ expected ): void
331337 {
332338 $ this ->validation ->setRules (['foo ' => 'differs[bar] ' ]);
333- $ this ->assertSame (! $ expected , $ this ->validation ->run ($ data ));
339+ $ this ->assertSame ($ expected , $ this ->validation ->run ($ data ));
340+ }
341+
342+ public static function provideDiffers (): iterable
343+ {
344+ yield from [
345+ 'foo bar not exist ' => [[], false ],
346+ 'bar not exist ' => [['foo ' => null ], false ],
347+ 'foo not exist ' => [['bar ' => null ], false ],
348+ 'foo bar null ' => [['foo ' => null , 'bar ' => null ], false ],
349+ 'foo bar string match ' => [['foo ' => 'match ' , 'bar ' => 'match ' ], false ],
350+ 'foo bar string not match ' => [['foo ' => 'match ' , 'bar ' => 'nope ' ], true ],
351+ 'foo bar float match ' => [['foo ' => 1.2 , 'bar ' => 1.2 ], false ],
352+ 'foo bar float not match ' => [['foo ' => 1.2 , 'bar ' => 2.3 ], true ],
353+ 'foo bar bool match ' => [['foo ' => true , 'bar ' => true ], false ],
354+ ];
334355 }
335356
336357 /**
0 commit comments