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)
450
450
{
451
451
list ($ lft , $ rgt ) = $ this ->model ->newServiceQuery ()->getPlainNodeData ($ key , true );
452
452
453
- if ($ lft < $ position && $ position < $ rgt )
453
+ if ($ lft < $ position && $ position <= $ rgt )
454
454
{
455
455
throw new LogicException ('Cannot move node into itself. ' );
456
456
}
Original file line number Diff line number Diff line change @@ -211,14 +211,34 @@ public function testCategoryMovesUp()
211
211
/**
212
212
* @expectedException Exception
213
213
*/
214
- public function testFailsToInsertIntoItself ()
214
+ public function testFailsToInsertIntoChild ()
215
215
{
216
216
$ node = $ this ->findCategory ('notebooks ' );
217
217
$ target = $ node ->children ()->first ();
218
218
219
219
$ node ->afterNode ($ target )->save ();
220
220
}
221
221
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
+
222
242
public function testWithoutRootWorks ()
223
243
{
224
244
$ result = Category::withoutRoot ()->pluck ('name ' );
You can’t perform that action at this time.
0 commit comments