File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ public function moveNode($key, $position)
450450 {
451451 list ($ lft , $ rgt ) = $ this ->model ->newServiceQuery ()->getPlainNodeData ($ key , true );
452452
453- if ($ lft < $ position && $ position < $ rgt )
453+ if ($ lft < $ position && $ position <= $ rgt )
454454 {
455455 throw new LogicException ('Cannot move node into itself. ' );
456456 }
Original file line number Diff line number Diff line change @@ -211,14 +211,34 @@ public function testCategoryMovesUp()
211211 /**
212212 * @expectedException Exception
213213 */
214- public function testFailsToInsertIntoItself ()
214+ public function testFailsToInsertIntoChild ()
215215 {
216216 $ node = $ this ->findCategory ('notebooks ' );
217217 $ target = $ node ->children ()->first ();
218218
219219 $ node ->afterNode ($ target )->save ();
220220 }
221221
222+ /**
223+ * @expectedException Exception
224+ */
225+ public function testFailsToAppendIntoItself ()
226+ {
227+ $ node = $ this ->findCategory ('notebooks ' );
228+
229+ $ node ->appendTo ($ node )->save ();
230+ }
231+
232+ /**
233+ * @expectedException Exception
234+ */
235+ public function testFailsToPrependIntoItself ()
236+ {
237+ $ node = $ this ->findCategory ('notebooks ' );
238+
239+ $ node ->prependTo ($ node )->save ();
240+ }
241+
222242 public function testWithoutRootWorks ()
223243 {
224244 $ result = Category::withoutRoot ()->pluck ('name ' );
You can’t perform that action at this time.
0 commit comments