diff --git a/tests/TestCase/Model/Behavior/TreeBehaviorTest.php b/tests/TestCase/Model/Behavior/TreeBehaviorTest.php index 8db0fe6e6fb..aa44d742dd9 100644 --- a/tests/TestCase/Model/Behavior/TreeBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/TreeBehaviorTest.php @@ -540,4 +540,20 @@ public function testDeleteSubTree() { $this->assertEquals($expected, $result); } +/** + * Test deleting a root node + * + * @return void + */ + public function testDeleteRoot() { + $table = TableRegistry::get('NumberTrees'); + $table->addBehavior('Tree'); + $entity = $table->get(1); + $this->assertTrue($table->delete($entity)); + $result = $table->find()->order('lft')->hydrate(false)->toArray(); + $table->recover(); + $expected = $table->find()->order('lft')->hydrate(false)->toArray(); + $this->assertEquals($expected, $result); + } + }