public function testTreeIsFixed() { Category::where('id', '=', 5)->update(['_lft' => 14]); Category::where('id', '=', 8)->update(['parent_id' => 2]); Category::where('id', '=', 11)->update(['_lft' => 20]); Category::where('id', '=', 2)->update(['parent_id' => 24]); $fixed = Category::fixTree(); $this->assertTrue($fixed > 0); $this->assertTreeNotBroken(); $node = Category::find(8); $this->assertEquals(2, $node->getParentId()); $node = Category::find(2); $this->assertEquals(null, $node->getParentId()); }
public function testTreeIsFixed() { Category::where('id', '=', 5)->update(['_lft' => 14]); Category::where('id', '=', 8)->update(['parent_id' => 2]); $fixed = Category::fixTree(); $this->assertTrue($fixed > 0); $this->assertTreeNotBroken(); }