public function testInsertAsNextSiblingOfExistingObject()
 {
     \NestedSetTable9Query::create()->deleteAll();
     $t = new \NestedSetTable9();
     $t->makeRoot();
     $t->save();
     $t1 = new \NestedSetTable9();
     $t1->insertAsFirstChildOf($t);
     $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());
     $t2 = new \NestedSetTable9();
     $t2->save();
     $t2->insertAsNextSiblingOf($t1);
     $this->assertEquals(4, $t2->getLeftValue());
     $this->assertEquals(5, $t2->getRightValue());
     $this->assertEquals(1, $t2->getLevel());
     $t2->save();
     $this->assertEquals(1, $t->getLeftValue());
     $this->assertEquals(6, $t->getRightValue());
     $this->assertEquals(0, $t->getLevel());
     $this->assertEquals(2, $t1->getLeftValue());
     $this->assertEquals(3, $t1->getRightValue());
     $this->assertEquals(1, $t1->getLevel());
     $this->assertEquals(4, $t2->getLeftValue());
     $this->assertEquals(5, $t2->getRightValue());
     $this->assertEquals(1, $t2->getLevel());
 }
 public function testIsValid()
 {
     $this->assertTrue(method_exists('NestedSetTable9Query', 'isValid'), 'nested_set adds an isValid() method');
     $this->assertFalse(\NestedSetTable9Query::isValid(null), 'isValid() returns false when passed null ');
     $t1 = new \NestedSetTable9();
     $this->assertFalse(\NestedSetTable9Query::isValid($t1), 'isValid() returns false when passed an empty node object');
     $t2 = new \NestedSetTable9();
     $t2->setLeftValue(5)->setRightValue(2);
     $this->assertFalse(\NestedSetTable9Query::isValid($t2), 'isValid() returns false when passed a node object with left > right');
     $t3 = new \NestedSetTable9();
     $t3->setLeftValue(5)->setRightValue(5);
     $this->assertFalse(\NestedSetTable9Query::isValid($t3), 'isValid() returns false when passed a node object with left = right');
     $t4 = new \NestedSetTable9();
     $t4->setLeftValue(2)->setRightValue(5);
     $this->assertTrue(\NestedSetTable9Query::isValid($t4), 'isValid() returns true when passed a node object with left < right');
 }