From 507f94a578cc97b69df6f878a4c9305375809080 Mon Sep 17 00:00:00 2001 From: Jan Iwanow Date: Wed, 4 Feb 2015 04:07:23 +1000 Subject: [PATCH] added the whole subtree removal test --- tests/EntityTestCase.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/EntityTestCase.php b/tests/EntityTestCase.php index 56e4362..4b6c351 100644 --- a/tests/EntityTestCase.php +++ b/tests/EntityTestCase.php @@ -717,6 +717,15 @@ public function testForceDeleteDeepSubtree() $this->assertEquals(1, ClosureTable::whereBetween('ancestor', [1, 9])->count()); } + public function testForceDeleteSubtreeWithSelf() + { + $entity = Entity::find(9); + $entity->deleteSubtree(true, true); + + $this->assertEquals(0, Entity::whereBetween('id', [9, 15])->count()); + $this->assertEquals(0, ClosureTable::whereBetween('ancestor', [9, 15])->count()); + } + public function testCreateFromArray() { $array = [