Skip to content

Commit 2ee10c6

Browse files
committed
improved test coverage
1 parent 55e22ed commit 2ee10c6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Base.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function __construct(string $country = null)
1919
"country" => "nullable|string|in:US,CA",
2020
]);
2121

22-
if ($v->failed()) {
22+
if ($v->fails()) {
2323
throw new \Exception($v->errors()->first(), 1);
2424
}
2525

tests/ValidatorTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use LVR\State\Abbr;
77
use LVR\State\Full;
88
use Validator;
9+
use Exception;
910

1011
class ValidatorTest extends TestCase
1112
{
@@ -28,6 +29,12 @@ protected function validate($value, Rule $rule)
2829
return !(Validator::make(['attr' => $value], ['attr' => $rule])->fails());
2930
}
3031

32+
public function testWithInvalidCountry()
33+
{
34+
$this->expectException(Exception::class);
35+
$this->validate("UT", new Abbr("ZZ"));
36+
}
37+
3138
public function testValidatorSimple()
3239
{
3340
$this->assertEquals(true, $this->validate('UT', new Abbr));

0 commit comments

Comments
 (0)