public function testIsValid()
 {
     $this->assertTrue(method_exists('Table9Peer', 'isValid'), 'nested_set adds an isValid() method');
     $this->assertFalse(Table9Peer::isValid(null), 'isValid() returns false when passed null ');
     $t1 = new Table9();
     $this->assertFalse(Table9Peer::isValid($t1), 'isValid() returns false when passed an empty node object');
     $t2 = new Table9();
     $t2->setLeftValue(5)->setRightValue(2);
     $this->assertFalse(Table9Peer::isValid($t2), 'isValid() returns false when passed a node object with left > right');
     $t3 = new Table9();
     $t3->setLeftValue(5)->setRightValue(5);
     $this->assertFalse(Table9Peer::isValid($t3), 'isValid() returns false when passed a node object with left = right');
     $t4 = new Table9();
     $t4->setLeftValue(2)->setRightValue(5);
     $this->assertTrue(Table9Peer::isValid($t4), 'isValid() returns true when passed a node object with left < right');
 }
 public function testFindRoot()
 {
     $this->assertTrue(method_exists('\\Propel\\Tests\\Bookstore\\Behavior\\Table9Query', 'findRoot'), 'nested_set adds a findRoot() method');
     Table9Query::create()->deleteAll();
     $this->assertNull(Table9Query::create()->findRoot(), 'findRoot() returns null as long as no root node is defined');
     $t1 = new Table9();
     $t1->setLeftValue(123);
     $t1->setRightValue(456);
     $t1->save();
     $this->assertNull(Table9Query::create()->findRoot(), 'findRoot() returns null as long as no root node is defined');
     $t2 = new Table9();
     $t2->setLeftValue(1);
     $t2->setRightValue(2);
     $t2->save();
     $this->assertEquals(Table9Query::create()->findRoot(), $t2, 'findRoot() retrieves the root node');
 }
 public function testIsInTree()
 {
     $t1 = new Table9();
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for nodes with no left and right value');
     $t1->save();
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for saved nodes with no left and right value');
     $t1->setLeftValue(1)->setRightValue(0);
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for nodes with zero left value');
     $t1->setLeftValue(0)->setRightValue(1);
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for nodes with zero right value');
     $t1->setLeftValue(1)->setRightValue(1);
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for nodes with equal left and right value');
     $t1->setLeftValue(1)->setRightValue(2);
     $this->assertTrue($t1->isInTree(), 'inInTree() returns true for nodes with left < right value');
     $t1->setLeftValue(2)->setRightValue(1);
     $this->assertFalse($t1->isInTree(), 'inInTree() returns false for nodes with left > right value');
 }