File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -43,4 +43,13 @@ public function testSaveThrowsAValidationException()
43
43
$ model = new InvalidModel ();
44
44
$ model ->save ();
45
45
}
46
+
47
+ /**
48
+ * @expectedException \Illuminate\Validation\ValidationException
49
+ */
50
+ public function testValidateThrowsAValidationException ()
51
+ {
52
+ $ model = new InvalidModel ();
53
+ $ model ->validate ();
54
+ }
46
55
}
Original file line number Diff line number Diff line change @@ -41,4 +41,15 @@ protected function setUpContainer()
41
41
return $ validator ;
42
42
});
43
43
}
44
+
45
+ /**
46
+ * A simple helper so our test case expectations are a little more clear.
47
+ *
48
+ * @param mixed $value
49
+ * The value that we are asserting is void.
50
+ */
51
+ protected function assertVoid ($ value )
52
+ {
53
+ $ this ->assertNull ($ value );
54
+ }
44
55
}
Original file line number Diff line number Diff line change 6
6
use Illuminate \Database \Eloquent \Model as EloquentModel ;
7
7
use Jaspaul \EloquentModelValidation \Contracts \Validatable ;
8
8
9
- class ModelTest extends TestCase
9
+ class ValidModelTest extends TestCase
10
10
{
11
11
public function testItCanBeConstructed ()
12
12
{
@@ -27,4 +27,10 @@ public function testGetErrorsReturnsAnEmptyMessageBag()
27
27
$ errors = $ model ->getErrors ();
28
28
$ this ->assertTrue ($ errors ->isEmpty ());
29
29
}
30
+
31
+ public function testValidateDoesNotThrowAValidationException ()
32
+ {
33
+ $ model = new ValidModel ();
34
+ $ this ->assertVoid ($ model ->validate ());
35
+ }
30
36
}
You can’t perform that action at this time.
0 commit comments