File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,9 @@ use LVR\Phone\NANP;
3535use LVR\Phone\Digits;
3636
3737// Test any phone number
38- $request->validate(['test' => '15556667777'], new Phone); // Pass!
39- $request->validate(['test' => '+15556667777'], new Phone); // Pass!
40- $request->validate(['test' => '+1 (555) 666-7777'], new Phone); // Pass!
38+ $request->validate(['test' => '15556667777'], ['test' => new Phone] ); // Pass!
39+ $request->validate(['test' => '+15556667777'], ['test' => new Phone] ); // Pass!
40+ $request->validate(['test' => '+1 (555) 666-7777'], ['test' => new Phone] ); // Pass!
4141
4242// Test for E164
4343$request->validate(['test' => '+15556667777'], ['test' => new E164]); // Pass!
Original file line number Diff line number Diff line change 2727 },
2828 "minimum-stability" : " stable" ,
2929 "require" : {
30- "illuminate/validation" : " ^5.5" ,
31- "illuminate/support" : " ^5.5" ,
30+ "illuminate/contracts" : " ^5.5" ,
3231 "php" : " ^7.0"
3332 },
3433 "require-dev" : {
Original file line number Diff line number Diff line change @@ -75,7 +75,16 @@ public function testValidatorPhoneNANP()
7575
7676 public function testValidatorErrorMessage ()
7777 {
78+ $ validator = Validator::make (['attr ' => '+1555 ex 1234 ' ], ['attr ' => new Phone ]);
79+ $ this ->assertEquals ("Incorrect phone format for attr. " , $ validator ->errors ()->first ());
80+
7881 $ validator = Validator::make (['attr ' => '+1555 ex 1234 ' ], ['attr ' => new E164 ]);
7982 $ this ->assertEquals ("attr must be in E.164 phone format " , $ validator ->errors ()->first ());
83+
84+ $ validator = Validator::make (['attr ' => '+1555 ex 1234 ' ], ['attr ' => new NANP ]);
85+ $ this ->assertEquals ("attr must be in the NANP phone format " , $ validator ->errors ()->first ());
86+
87+ $ validator = Validator::make (['attr ' => '+1555 ex 1234 ' ], ['attr ' => new Digits ]);
88+ $ this ->assertEquals ("attr must be in digits only phone format " , $ validator ->errors ()->first ());
8089 }
8190}
You can’t perform that action at this time.
0 commit comments