@@ -38,7 +38,7 @@ public function testGetDefinitions()
3838 {
3939 $ definitions = static ::$ fm ->getDefinitions ();
4040
41- $ this ->assertCount (39 , $ definitions );
41+ $ this ->assertCount (40 , $ definitions );
4242 }
4343
4444 public function testBasicDefinitionFunctions ()
@@ -269,6 +269,30 @@ public function testSeed()
269269 $ this ->assertNotEquals ($ users [0 ], $ users [1 ]);
270270 }
271271
272+ /**
273+ * @expectedException RuntimeException
274+ * @expectedExceptionMessage Cannot save user model.
275+ */
276+ public function testSeedWithSaving ()
277+ {
278+ $ users = static ::$ fm ->seed (2 , 'CrashingUserModelStub ' , [], true );
279+
280+ $ this ->assertCount (2 , $ users );
281+ $ this ->assertInstanceOf ('CrashingUserModelStub ' , $ users [0 ]);
282+ $ this ->assertInstanceOf ('CrashingUserModelStub ' , $ users [1 ]);
283+ $ this ->assertNotEquals ($ users [0 ], $ users [1 ]);
284+ }
285+
286+ public function testSeedWithoutSaving ()
287+ {
288+ $ users = static ::$ fm ->seed (2 , 'CrashingUserModelStub ' , [], false );
289+
290+ $ this ->assertCount (2 , $ users );
291+ $ this ->assertInstanceOf ('CrashingUserModelStub ' , $ users [0 ]);
292+ $ this ->assertInstanceOf ('CrashingUserModelStub ' , $ users [1 ]);
293+ $ this ->assertNotEquals ($ users [0 ], $ users [1 ]);
294+ }
295+
272296 public function testInstance ()
273297 {
274298 $ user = static ::$ fm ->instance ('UserModelStub ' );
@@ -382,6 +406,19 @@ public function delete()
382406 }
383407}
384408
409+ class CrashingUserModelStub
410+ {
411+ public function save ()
412+ {
413+ throw new RuntimeException ('Cannot save user model. ' );
414+ }
415+
416+ public function delete ()
417+ {
418+ throw new RuntimeException ('Cannot delete user model. ' );
419+ }
420+ }
421+
385422class ProfileModelStub
386423{
387424 public function save ()
0 commit comments