@@ -63,7 +63,7 @@ public function assertTreeNotBroken($table = 'categories')
6363
6464 $ sql = 'select max(error) as errors from ( ' .implode (' union ' , $ checks ).') _ ' ;
6565
66- $ actual = Capsule::connection ()->selectOne ($ sql );
66+ $ actual = ( array ) Capsule::connection ()->selectOne ($ sql );
6767
6868 $ this ->assertEquals (array ('errors ' => null ), $ actual , "The tree structure of $ table is broken! " );
6969 }
@@ -137,7 +137,7 @@ public function testRecievesValidValuesWhenAppendedTo()
137137
138138 $ accepted = array ($ root ->_rgt , $ root ->_rgt + 1 , $ root ->id );
139139
140- $ root ->append ($ node );
140+ $ root ->appendNode ($ node );
141141
142142 $ this ->assertTrue ($ node ->hasMoved ());
143143 $ this ->assertEquals ($ accepted , $ this ->nodeValues ($ node ));
@@ -150,7 +150,7 @@ public function testRecievesValidValuesWhenPrependedTo()
150150 {
151151 $ root = Category::root ();
152152 $ node = new Category ([ 'name ' => 'test ' ]);
153- $ root ->prepend ($ node );
153+ $ root ->prependNode ($ node );
154154
155155 $ this ->assertTrue ($ node ->hasMoved ());
156156 $ this ->assertEquals (array ($ root ->_lft + 1 , $ root ->_lft + 2 , $ root ->id ), $ this ->nodeValues ($ node ));
@@ -164,7 +164,7 @@ public function testRecievesValidValuesWhenInsertedAfter()
164164 {
165165 $ target = $ this ->findCategory ('apple ' );
166166 $ node = new Category ([ 'name ' => 'test ' ]);
167- $ node ->after ($ target )->save ();
167+ $ node ->afterNode ($ target )->save ();
168168
169169 $ this ->assertTrue ($ node ->hasMoved ());
170170 $ this ->assertEquals (array ($ target ->_rgt + 1 , $ target ->_rgt + 2 , $ target ->parent ->id ), $ this ->nodeValues ($ node ));
@@ -177,7 +177,7 @@ public function testRecievesValidValuesWhenInsertedBefore()
177177 {
178178 $ target = $ this ->findCategory ('apple ' );
179179 $ node = new Category ([ 'name ' => 'test ' ]);
180- $ node ->before ($ target )->save ();
180+ $ node ->beforeNode ($ target )->save ();
181181
182182 $ this ->assertTrue ($ node ->hasMoved ());
183183 $ this ->assertEquals (array ($ target ->_lft , $ target ->_lft + 1 , $ target ->parent ->id ), $ this ->nodeValues ($ node ));
@@ -189,7 +189,7 @@ public function testCategoryMovesDown()
189189 $ node = $ this ->findCategory ('apple ' );
190190 $ target = $ this ->findCategory ('mobile ' );
191191
192- $ target ->append ($ node );
192+ $ target ->appendNode ($ node );
193193
194194 $ this ->assertTrue ($ node ->hasMoved ());
195195 $ this ->assertNodeRecievesValidValues ($ node );
@@ -201,7 +201,7 @@ public function testCategoryMovesUp()
201201 $ node = $ this ->findCategory ('samsung ' );
202202 $ target = $ this ->findCategory ('notebooks ' );
203203
204- $ target ->append ($ node );
204+ $ target ->appendNode ($ node );
205205
206206 $ this ->assertTrue ($ node ->hasMoved ());
207207 $ this ->assertTreeNotBroken ();
@@ -216,7 +216,7 @@ public function testFailsToInsertIntoItself()
216216 $ node = $ this ->findCategory ('notebooks ' );
217217 $ target = $ node ->children ()->first ();
218218
219- $ node ->after ($ target )->save ();
219+ $ node ->afterNode ($ target )->save ();
220220 }
221221
222222 public function testWithoutRootWorks ()
@@ -229,42 +229,42 @@ public function testWithoutRootWorks()
229229 public function testAncestorsReturnsAncestorsWithoutNodeItself ()
230230 {
231231 $ node = $ this ->findCategory ('apple ' );
232- $ path = $ node ->ancestors ()->lists ('name ' );
232+ $ path = $ node ->ancestors ()->lists ('name ' )-> all () ;
233233
234234 $ this ->assertEquals (array ('store ' , 'notebooks ' ), $ path );
235235 }
236236
237237 public function testGetsAncestorsByStatic ()
238238 {
239- $ path = Category::ancestorsOf (3 )->lists ('name ' );
239+ $ path = Category::ancestorsOf (3 )->lists ('name ' )-> all () ;
240240
241241 $ this ->assertEquals (array ('store ' , 'notebooks ' ), $ path );
242242 }
243243
244244 public function testGetsAncestorsDirect ()
245245 {
246- $ path = Category::find (8 )->getAncestors ()->lists ('id ' );
246+ $ path = Category::find (8 )->getAncestors ()->lists ('id ' )-> all () ;
247247
248248 $ this ->assertEquals (array (1 , 5 , 7 ), $ path );
249249 }
250250
251251 public function testDescendants ()
252252 {
253253 $ node = $ this ->findCategory ('mobile ' );
254- $ descendants = $ node ->descendants ()->lists ('name ' );
254+ $ descendants = $ node ->descendants ()->lists ('name ' )-> all () ;
255255 $ expected = array ('nokia ' , 'samsung ' , 'galaxy ' , 'sony ' , 'lenovo ' );
256256
257257 $ this ->assertEquals ($ expected , $ descendants );
258258
259- $ descendants = $ node ->getDescendants ()->lists ('name ' );
259+ $ descendants = $ node ->getDescendants ()->lists ('name ' )-> all () ;
260260
261261 $ this ->assertEquals (count ($ descendants ), $ node ->getDescendantCount ());
262262 $ this ->assertEquals ($ expected , $ descendants );
263263 }
264264
265265 public function testWithDepthWorks ()
266266 {
267- $ nodes = Category::withDepth ()->limit (4 )->lists ('depth ' );
267+ $ nodes = Category::withDepth ()->limit (4 )->lists ('depth ' )-> all () ;
268268
269269 $ this ->assertEquals (array (0 , 1 , 2 , 2 ), $ nodes );
270270 }
@@ -378,17 +378,17 @@ public function testFailsToSaveNodeUntilParentIsSaved()
378378 public function testSiblings ()
379379 {
380380 $ node = $ this ->findCategory ('samsung ' );
381- $ siblings = $ node ->siblings ()->lists ('id ' );
382- $ next = $ node ->nextSiblings ()->lists ('id ' );
383- $ prev = $ node ->prevSiblings ()->lists ('id ' );
381+ $ siblings = $ node ->siblings ()->lists ('id ' )-> all () ;
382+ $ next = $ node ->nextSiblings ()->lists ('id ' )-> all () ;
383+ $ prev = $ node ->prevSiblings ()->lists ('id ' )-> all () ;
384384
385385 $ this ->assertEquals (array (6 , 9 , 10 ), $ siblings );
386386 $ this ->assertEquals (array (9 , 10 ), $ next );
387387 $ this ->assertEquals (array (6 ), $ prev );
388388
389- $ siblings = $ node ->getSiblings ()->lists ('id ' );
390- $ next = $ node ->getNextSiblings ()->lists ('id ' );
391- $ prev = $ node ->getPrevSiblings ()->lists ('id ' );
389+ $ siblings = $ node ->getSiblings ()->lists ('id ' )-> all () ;
390+ $ next = $ node ->getNextSiblings ()->lists ('id ' )-> all () ;
391+ $ prev = $ node ->getPrevSiblings ()->lists ('id ' )-> all () ;
392392
393393 $ this ->assertEquals (array (6 , 9 , 10 ), $ siblings );
394394 $ this ->assertEquals (array (9 , 10 ), $ next );
@@ -404,7 +404,7 @@ public function testSiblings()
404404 public function testFetchesReversed ()
405405 {
406406 $ node = $ this ->findCategory ('sony ' );
407- $ siblings = $ node ->prevSiblings ()->reversed ()->pluck ('id ' );
407+ $ siblings = $ node ->prevSiblings ()->reversed ()->value ('id ' );
408408
409409 $ this ->assertEquals (7 , $ siblings );
410410 }
@@ -468,15 +468,15 @@ public function testToTreeBuildsWithRootItemIdProvided()
468468 public function testRetrievesNextNode ()
469469 {
470470 $ node = $ this ->findCategory ('apple ' );
471- $ next = $ node ->next ()->first ();
471+ $ next = $ node ->nextNodes ()->first ();
472472
473473 $ this ->assertEquals ('lenovo ' , $ next ->name );
474474 }
475475
476476 public function testRetrievesPrevNode ()
477477 {
478478 $ node = $ this ->findCategory ('apple ' );
479- $ next = $ node ->prev ()->first ();
479+ $ next = $ node ->prevNodes ()->first ();
480480
481481 $ this ->assertEquals ('notebooks ' , $ next ->name );
482482 }
@@ -487,11 +487,11 @@ public function testMultipleAppendageWorks()
487487
488488 $ child = new Category ([ 'name ' => 'test ' ]);
489489
490- $ parent ->append ($ child );
490+ $ parent ->appendNode ($ child );
491491
492- $ child ->append (new Category ([ 'name ' => 'sub ' ]));
492+ $ child ->appendNode (new Category ([ 'name ' => 'sub ' ]));
493493
494- $ parent ->append (new Category ([ 'name ' => 'test2 ' ]));
494+ $ parent ->appendNode (new Category ([ 'name ' => 'test2 ' ]));
495495
496496 $ this ->assertTreeNotBroken ();
497497 }
@@ -592,15 +592,15 @@ public function testWhereDescendantsOf()
592592 public function testAncestorsByNode ()
593593 {
594594 $ category = $ this ->findCategory ('apple ' );
595- $ ancestors = Category::whereAncestorOf ($ category )->lists ('id ' );
595+ $ ancestors = Category::whereAncestorOf ($ category )->lists ('id ' )-> all () ;
596596
597597 $ this ->assertEquals ([ 1 , 2 ], $ ancestors );
598598 }
599599
600600 public function testDescendantsByNode ()
601601 {
602602 $ category = $ this ->findCategory ('notebooks ' );
603- $ res = Category::whereDescendantOf ($ category )->lists ('id ' );
603+ $ res = Category::whereDescendantOf ($ category )->lists ('id ' )-> all () ;
604604
605605 $ this ->assertEquals ([ 3 , 4 ], $ res );
606606 }
0 commit comments