@@ -221,32 +221,29 @@ public function testCategoryMovesUp()
221221 $ this ->assertNodeReceivesValidValues ($ node );
222222 }
223223
224- /**
225- * @expectedException Exception
226- */
227224 public function testFailsToInsertIntoChild ()
228225 {
226+ $ this ->expectException (Exception::class);
227+
229228 $ node = $ this ->findCategory ('notebooks ' );
230229 $ target = $ node ->children ()->first ();
231230
232231 $ node ->afterNode ($ target )->save ();
233232 }
234233
235- /**
236- * @expectedException Exception
237- */
238234 public function testFailsToAppendIntoItself ()
239235 {
236+ $ this ->expectException (Exception::class);
237+
240238 $ node = $ this ->findCategory ('notebooks ' );
241239
242240 $ node ->appendToNode ($ node )->save ();
243241 }
244242
245- /**
246- * @expectedException Exception
247- */
248243 public function testFailsToPrependIntoItself ()
249244 {
245+ $ this ->expectException (Exception::class);
246+
250247 $ node = $ this ->findCategory ('notebooks ' );
251248
252249 $ node ->prependTo ($ node )->save ();
@@ -338,11 +335,10 @@ public function testParentIdAttributeAccessorAppendsNode()
338335 $ this ->assertTrue ($ node ->isRoot ());
339336 }
340337
341- /**
342- * @expectedException Exception
343- */
344338 public function testFailsToSaveNodeUntilNotInserted ()
345339 {
340+ $ this ->expectException (Exception::class);
341+
346342 $ node = new Category ;
347343 $ node ->save ();
348344 }
@@ -405,11 +401,10 @@ public function testSoftDeletedNodeisDeletedWhenParentIsDeleted()
405401 $ this ->assertNull ($ this ->findCategory ('sony ' ));
406402 }
407403
408- /**
409- * @expectedException Exception
410- */
411404 public function testFailsToSaveNodeUntilParentIsSaved ()
412405 {
406+ $ this ->expectException (Exception::class);
407+
413408 $ node = new Category (array ('title ' => 'Node ' ));
414409 $ parent = new Category (array ('title ' => 'Parent ' ));
415410
@@ -641,11 +636,10 @@ public function testDescendantsOfNonExistingNode()
641636 $ this ->assertTrue ($ node ->getDescendants ()->isEmpty ());
642637 }
643638
644- /**
645- * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
646- */
647639 public function testWhereDescendantsOf ()
648640 {
641+ $ this ->expectException (\Illuminate \Database \Eloquent \ModelNotFoundException::class);
642+
649643 Category::whereDescendantOf (124 )->get ();
650644 }
651645
@@ -852,11 +846,10 @@ public function testRebuildTreeWithDeletion()
852846 $ this ->assertTrue ($ nodes ->count () > 1 );
853847 }
854848
855- /**
856- * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
857- */
858849 public function testRebuildFailsWithInvalidPK ()
859850 {
851+ $ this ->expectException (\Illuminate \Database \Eloquent \ModelNotFoundException::class);
852+
860853 Category::rebuildTree ([ [ 'id ' => 24 ] ]);
861854 }
862855
0 commit comments