public function testRestoreUnshiftsIndexesFullSubtree() { $this->assertTrue(SoftCategory::isValidNestedSet()); $this->categories('Root 1', 'SoftCategory')->delete(); $this->assertTrue(SoftCategory::isValidNestedSet()); SoftCategory::withTrashed()->where('name', 'Root 1')->first()->restore(); $this->assertTrue(SoftCategory::isValidNestedSet()); $expected = array($this->categories('Child 1', 'SoftCategory'), $this->categories('Child 2', 'SoftCategory'), $this->categories('Child 2.1', 'SoftCategory'), $this->categories('Child 3', 'SoftCategory')); $this->assertEquals($expected, $this->categories('Root 1', 'SoftCategory')->getDescendants()->all()); $this->assertEquals(1, $this->categories('Root 1', 'SoftCategory')->getLeft()); $this->assertEquals(10, $this->categories('Root 1', 'SoftCategory')->getRight()); $this->assertEquals(2, $this->categories('Child 1', 'SoftCategory')->getLeft()); $this->assertEquals(3, $this->categories('Child 1', 'SoftCategory')->getRight()); $this->assertEquals(4, $this->categories('Child 2', 'SoftCategory')->getLeft()); $this->assertEquals(7, $this->categories('Child 2', 'SoftCategory')->getRight()); $this->assertEquals(5, $this->categories('Child 2.1', 'SoftCategory')->getLeft()); $this->assertEquals(6, $this->categories('Child 2.1', 'SoftCategory')->getRight()); $this->assertEquals(8, $this->categories('Child 3', 'SoftCategory')->getLeft()); $this->assertEquals(9, $this->categories('Child 3', 'SoftCategory')->getRight()); }