Skip to content

Commit

Permalink
improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercd100 committed Sep 12, 2017
1 parent 55e22ed commit 2ee10c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function __construct(string $country = null)
"country" => "nullable|string|in:US,CA",
]);

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

Expand Down
7 changes: 7 additions & 0 deletions tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use LVR\State\Abbr;
use LVR\State\Full;
use Validator;
use Exception;

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

public function testWithInvalidCountry()
{
$this->expectException(Exception::class);
$this->validate("UT", new Abbr("ZZ"));
}

public function testValidatorSimple()
{
$this->assertEquals(true, $this->validate('UT', new Abbr));
Expand Down

0 comments on commit 2ee10c6

Please sign in to comment.