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()
4343 $ model = new InvalidModel ();
4444 $ model ->save ();
4545 }
46+
47+ /**
48+ * @expectedException \Illuminate\Validation\ValidationException
49+ */
50+ public function testValidateThrowsAValidationException ()
51+ {
52+ $ model = new InvalidModel ();
53+ $ model ->validate ();
54+ }
4655}
Original file line number Diff line number Diff line change @@ -41,4 +41,15 @@ protected function setUpContainer()
4141 return $ validator ;
4242 });
4343 }
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+ }
4455}
Original file line number Diff line number Diff line change 66use Illuminate \Database \Eloquent \Model as EloquentModel ;
77use Jaspaul \EloquentModelValidation \Contracts \Validatable ;
88
9- class ModelTest extends TestCase
9+ class ValidModelTest extends TestCase
1010{
1111 public function testItCanBeConstructed ()
1212 {
@@ -27,4 +27,10 @@ public function testGetErrorsReturnsAnEmptyMessageBag()
2727 $ errors = $ model ->getErrors ();
2828 $ this ->assertTrue ($ errors ->isEmpty ());
2929 }
30+
31+ public function testValidateDoesNotThrowAValidationException ()
32+ {
33+ $ model = new ValidModel ();
34+ $ this ->assertVoid ($ model ->validate ());
35+ }
3036}
You can’t perform that action at this time.
0 commit comments