File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,26 @@ public function it_takes_excepion_to_models_that_do_not_implement_soft_deletes()
7575 new Tests \Entities \Comment (['body ' => 'This is the third test comment ' ]),
7676 ]);
7777
78- $ this ->assertCount (3 , $ post ->comments );
78+ $ post ->delete ();
79+ }
80+
81+ /**
82+ * @test
83+ * @expectedException \RuntimeException
84+ */
85+ public function it_takes_exception_to_models_trying_to_cascade_deletes_on_invalid_relationships ()
86+ {
87+ $ post = Tests \Entities \InvalidRelationshipPost::create ([
88+ 'title ' => 'Testing invalid cascade relationships ' ,
89+ 'body ' => 'Ensure you can only use this trait if the model defines valid relationships ' ,
90+ ]);
91+
92+ $ post ->comments ()->saveMany ([
93+ new Tests \Entities \Comment (['body ' => 'This is the first test comment ' ]),
94+ new Tests \Entities \Comment (['body ' => 'This is the second test comment ' ]),
95+ new Tests \Entities \Comment (['body ' => 'This is the third test comment ' ]),
96+ ]);
97+
7998 $ post ->delete ();
8099 }
81100}
You can’t perform that action at this time.
0 commit comments