@@ -2498,6 +2498,10 @@ public function count(): int
2498
2498
2499
2499
$ v = new Validator ($ trans , ['foo ' => 'foo ' , 'bar ' => '2 ' ], ['foo ' => 'missing_if:bar,1 ' ]);
2500
2500
$ this ->assertTrue ($ v ->passes ());
2501
+
2502
+ $ v = new Validator ($ trans ,['foo ' => [0 => ['bar ' => 1 , 'baz ' => 'should be missing ' ]]], ['foo.*.baz ' => 'missing_if:foo.*.bar,1 ' ]);
2503
+ $ this ->assertTrue ($ v ->fails ());
2504
+ $ this ->assertSame ('The foo.0.baz field must be missing when foo.0.bar is 1. ' , $ v ->errors ()->first ('foo.0.baz ' ));
2501
2505
}
2502
2506
2503
2507
public function testValidateMissingUnless ()
@@ -2537,6 +2541,10 @@ public function count(): int
2537
2541
2538
2542
$ v = new Validator ($ trans , ['foo ' => 'foo ' , 'bar ' => '1 ' ], ['foo ' => 'missing_unless:bar,1 ' ]);
2539
2543
$ this ->assertTrue ($ v ->passes ());
2544
+
2545
+ $ v = new Validator ($ trans ,['foo ' => [0 => ['bar ' => 0 , 'baz ' => 'should be missing ' ]]], ['foo.*.baz ' => 'missing_unless:foo.*.bar,1 ' ]);
2546
+ $ this ->assertTrue ($ v ->fails ());
2547
+ $ this ->assertSame ('The foo.0.baz field must be missing unless foo.0.bar is 1. ' , $ v ->errors ()->first ('foo.0.baz ' ));
2540
2548
}
2541
2549
2542
2550
public function testValidateMissingWith ()
@@ -2579,6 +2587,10 @@ public function count(): int
2579
2587
2580
2588
$ v = new Validator ($ trans , ['foo ' => 'foo ' , 'qux ' => '1 ' ], ['foo ' => 'missing_with:baz,bar ' ]);
2581
2589
$ this ->assertTrue ($ v ->passes ());
2590
+
2591
+ $ v = new Validator ($ trans ,['foo ' => [0 => ['bar ' => 1 , 'baz ' => 'should be missing ' ]]], ['foo.*.baz ' => 'missing_with:foo.*.bar,foo.*.fred ' ]);
2592
+ $ this ->assertTrue ($ v ->fails ());
2593
+ $ this ->assertSame ('The foo.0.baz field must be missing when foo.0.bar / foo.0.fred is present. ' , $ v ->errors ()->first ('foo.0.baz ' ));
2582
2594
}
2583
2595
2584
2596
public function testValidateMissingWithAll ()
@@ -2621,6 +2633,10 @@ public function count(): int
2621
2633
2622
2634
$ v = new Validator ($ trans , ['foo ' => [], 'bar ' => '2 ' , 'qux ' => '2 ' ], ['foo ' => 'missing_with_all:baz,bar ' ]);
2623
2635
$ this ->assertTrue ($ v ->passes ());
2636
+
2637
+ $ v = new Validator ($ trans ,['foo ' => [0 => ['bar ' => 1 ,'fred ' => 2 , 'baz ' => 'should be missing ' ]]], ['foo.*.baz ' => 'missing_with_all:foo.*.bar,foo.*.fred ' ]);
2638
+ $ this ->assertTrue ($ v ->fails ());
2639
+ $ this ->assertSame ('The foo.0.baz field must be missing when foo.0.bar / foo.0.fred are present. ' , $ v ->errors ()->first ('foo.0.baz ' ));
2624
2640
}
2625
2641
2626
2642
public function testValidateDeclinedIf ()
0 commit comments