Skip to content

Commit dc7b6c9

Browse files
add additional Test Cases
1 parent eae84ce commit dc7b6c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/ValidationTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ public function testUnique(): void
4141
['name' => 'required|unique:users']
4242
);
4343
$this->assertFalse($validator->fails());
44+
45+
User::create(['name' => 'Johnny Cash', 'email' => 'johnny.cash+200@gmail.com']);
46+
47+
$validator = Validator::make(
48+
['email' => 'johnny.cash+200@gmail.com'],
49+
['email' => 'required|unique:users']
50+
);
51+
$this->assertTrue($validator->fails());
52+
53+
$validator = Validator::make(
54+
['email' => 'johnny.cash+20@gmail.com'],
55+
['email' => 'required|unique:users']
56+
);
57+
$this->assertFalse($validator->fails());
58+
59+
$validator = Validator::make(
60+
['email' => 'johnny.cash+1@gmail.com'],
61+
['email' => 'required|unique:users']
62+
);
63+
$this->assertFalse($validator->fails());
4464
}
4565

4666
public function testExists(): void

0 commit comments

Comments
 (0)