public function testInsertAsLastChildOfExistingObject() { Table9Query::create()->deleteAll(); $t = new Table9(); $t->makeRoot(); $t->save(); $this->assertEquals(1, $t->getLeftValue()); $this->assertEquals(2, $t->getRightValue()); $this->assertEquals(0, $t->getLevel()); $t1 = new Table9(); $t1->save(); $t1->insertAsLastChildOf($t); $this->assertEquals(2, $t1->getLeftValue()); $this->assertEquals(3, $t1->getRightValue()); $this->assertEquals(1, $t1->getLevel()); $t1->save(); $this->assertEquals(1, $t->getLeftValue()); $this->assertEquals(4, $t->getRightValue()); $this->assertEquals(0, $t->getLevel()); $this->assertEquals(2, $t1->getLeftValue()); $this->assertEquals(3, $t1->getRightValue()); $this->assertEquals(1, $t1->getLevel()); }