@@ -639,6 +639,12 @@ public function testCapitalizedDisplayableValuesAreReplaced()
639639 $ v ->messages ()->setFormat (':message ' );
640640 $ this ->assertSame ('The foo field must be accepted when BAR is AAA. ' , $ v ->messages ()->first ('foo ' ));
641641
642+ $ trans = $ this ->getIlluminateArrayTranslator ();
643+ $ trans ->addLines (['validation.accepted_if ' => 'The :attribute field must be accepted when :other is :value. ' ], 'en ' );
644+ $ v = new Validator ($ trans , ['foo ' => 'no ' , 'bar ' => 'aAa ' ], ['foo ' => 'accepted_if:bar,aAa ' ]);
645+ $ this ->assertFalse ($ v ->passes ());
646+ $ this ->assertSame ('The foo field must be accepted when bar is aAa. ' , $ v ->messages ()->first ('foo ' ));
647+
642648 // in_array
643649 $ trans = $ this ->getIlluminateArrayTranslator ();
644650 $ trans ->addLines (['validation.in_array ' => 'The value of :attribute does not exist in :Other. ' ], 'en ' );
@@ -715,6 +721,12 @@ public function testCapitalizedDisplayableValuesAreReplaced()
715721 $ this ->assertFalse ($ v ->passes ());
716722 $ this ->assertSame ('The last field is required unless FIRST is in TAYLOR, SVEN. ' , $ v ->messages ()->first ('last ' ));
717723
724+ $ trans = $ this ->getIlluminateArrayTranslator ();
725+ $ trans ->addLines (['validation.required_unless ' => 'The :attribute field is required unless :other is in :values. ' ], 'en ' );
726+ $ v = new Validator ($ trans , ['firstName ' => 'dAyle ' , 'lastName ' => '' ], ['lastName ' => 'RequiredUnless:firstName,tAylor,sVen ' ]);
727+ $ this ->assertFalse ($ v ->passes ());
728+ $ this ->assertSame ('The last name field is required unless first name is in tAylor, sVen. ' , $ v ->messages ()->first ('lastName ' ));
729+
718730 // required_with
719731 $ trans = $ this ->getIlluminateArrayTranslator ();
720732 $ trans ->addLines (['validation.required_with ' => 'The :attribute field is required when :Values is present. ' ], 'en ' );
@@ -753,6 +765,12 @@ public function testCapitalizedDisplayableValuesAreReplaced()
753765 $ v = new Validator ($ trans , ['url ' => 'laravel.com ' ], ['url ' => 'starts_with:http,https ' ]);
754766 $ this ->assertFalse ($ v ->passes ());
755767 $ this ->assertSame ('The url must start with one of the following values HTTP, HTTPS ' , $ v ->messages ()->first ('url ' ));
768+
769+ $ trans = $ this ->getIlluminateArrayTranslator ();
770+ $ trans ->addLines (['validation.starts_with ' => 'The :attribute must start with one of the following values :values ' ], 'en ' );
771+ $ v = new Validator ($ trans , ['url ' => 'laravel.com ' ], ['url ' => 'starts_with:hTtp,hTtps ' ]);
772+ $ this ->assertFalse ($ v ->passes ());
773+ $ this ->assertSame ('The url must start with one of the following values hTtp, hTtps ' , $ v ->messages ()->first ('url ' ));
756774 }
757775
758776 public function testInputIsReplacedByItsDisplayableValue ()
0 commit comments