@@ -221,32 +221,29 @@ public function testCategoryMovesUp()
221
221
$ this ->assertNodeReceivesValidValues ($ node );
222
222
}
223
223
224
- /**
225
- * @expectedException Exception
226
- */
227
224
public function testFailsToInsertIntoChild ()
228
225
{
226
+ $ this ->expectException (Exception::class);
227
+
229
228
$ node = $ this ->findCategory ('notebooks ' );
230
229
$ target = $ node ->children ()->first ();
231
230
232
231
$ node ->afterNode ($ target )->save ();
233
232
}
234
233
235
- /**
236
- * @expectedException Exception
237
- */
238
234
public function testFailsToAppendIntoItself ()
239
235
{
236
+ $ this ->expectException (Exception::class);
237
+
240
238
$ node = $ this ->findCategory ('notebooks ' );
241
239
242
240
$ node ->appendToNode ($ node )->save ();
243
241
}
244
242
245
- /**
246
- * @expectedException Exception
247
- */
248
243
public function testFailsToPrependIntoItself ()
249
244
{
245
+ $ this ->expectException (Exception::class);
246
+
250
247
$ node = $ this ->findCategory ('notebooks ' );
251
248
252
249
$ node ->prependTo ($ node )->save ();
@@ -338,11 +335,10 @@ public function testParentIdAttributeAccessorAppendsNode()
338
335
$ this ->assertTrue ($ node ->isRoot ());
339
336
}
340
337
341
- /**
342
- * @expectedException Exception
343
- */
344
338
public function testFailsToSaveNodeUntilNotInserted ()
345
339
{
340
+ $ this ->expectException (Exception::class);
341
+
346
342
$ node = new Category ;
347
343
$ node ->save ();
348
344
}
@@ -405,11 +401,10 @@ public function testSoftDeletedNodeisDeletedWhenParentIsDeleted()
405
401
$ this ->assertNull ($ this ->findCategory ('sony ' ));
406
402
}
407
403
408
- /**
409
- * @expectedException Exception
410
- */
411
404
public function testFailsToSaveNodeUntilParentIsSaved ()
412
405
{
406
+ $ this ->expectException (Exception::class);
407
+
413
408
$ node = new Category (array ('title ' => 'Node ' ));
414
409
$ parent = new Category (array ('title ' => 'Parent ' ));
415
410
@@ -641,11 +636,10 @@ public function testDescendantsOfNonExistingNode()
641
636
$ this ->assertTrue ($ node ->getDescendants ()->isEmpty ());
642
637
}
643
638
644
- /**
645
- * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
646
- */
647
639
public function testWhereDescendantsOf ()
648
640
{
641
+ $ this ->expectException (\Illuminate \Database \Eloquent \ModelNotFoundException::class);
642
+
649
643
Category::whereDescendantOf (124 )->get ();
650
644
}
651
645
@@ -852,11 +846,10 @@ public function testRebuildTreeWithDeletion()
852
846
$ this ->assertTrue ($ nodes ->count () > 1 );
853
847
}
854
848
855
- /**
856
- * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
857
- */
858
849
public function testRebuildFailsWithInvalidPK ()
859
850
{
851
+ $ this ->expectException (\Illuminate \Database \Eloquent \ModelNotFoundException::class);
852
+
860
853
Category::rebuildTree ([ [ 'id ' => 24 ] ]);
861
854
}
862
855
0 commit comments