public function testRetrieveRoot()
 {
     $this->assertTrue(method_exists('Table10Peer', 'retrieveRoot'), 'nested_set adds a retrieveRoot() method');
     Table10Peer::doDeleteAll();
     $t1 = new Table10();
     $t1->setLeftValue(1);
     $t1->setRightValue(2);
     $t1->setScopeValue(2);
     $t1->save();
     $this->assertNull(Table10Peer::retrieveRoot(1), 'retrieveRoot() returns null as long as no root node is defined in the required scope');
     $t2 = new Table10();
     $t2->setLeftValue(1);
     $t2->setRightValue(2);
     $t2->setScopeValue(1);
     $t2->save();
     $this->assertEquals(Table10Peer::retrieveRoot(1), $t2, 'retrieveRoot() retrieves the root node in the required scope');
 }
 public function testCreateRoot()
 {
     $t = new Table10();
     $t->createRoot();
     $this->assertEquals($t->getLeftValue(), 1, 'createRoot() is an alias for makeRoot()');
     $this->assertEquals($t->getRightValue(), 2, 'createRoot() is an alias for makeRoot()');
     $this->assertEquals($t->getLevel(), 0, 'createRoot() is an alias for makeRoot()');
 }
 public function testInsertAsNextSiblingOfExistingObject()
 {
     Table10Query::create()->deleteAll();
     $t = new Table10();
     $t->setScopeValue(34);
     $t->makeRoot();
     $t->save();
     $t1 = new Table10();
     $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(34, $t1->getScopeValue());
     $this->assertEquals(1, $t1->getLevel());
     $t2 = new Table10();
     $t2->save();
     $t2->insertAsNextSiblingOf($t1);
     $this->assertEquals(4, $t2->getLeftValue());
     $this->assertEquals(5, $t2->getRightValue());
     $this->assertEquals(34, $t2->getScopeValue());
     $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(34, $t1->getScopeValue());
     $this->assertEquals(1, $t1->getLevel());
     $this->assertEquals(4, $t2->getLeftValue());
     $this->assertEquals(5, $t2->getRightValue());
     $this->assertEquals(34, $t2->getScopeValue());
     $this->assertEquals(1, $t2->getLevel());
 }
 public function testCompatibilityProxies()
 {
     $proxies = array('createRoot', 'retrieveParent', 'setParentNode', 'getNumberOfDescendants', 'getNumberOfChildren', 'retrievePrevSibling', 'retrieveNextSibling', 'retrieveFirstChild', 'retrieveLastChild', 'getPath');
     foreach ($proxies as $method) {
         $this->assertFalse(method_exists('Table9', $method), 'proxies are not enabled by default');
         $this->assertTrue(method_exists('Table10', $method), 'setting method_proxies to true adds compatibility proxies');
     }
     $t = new Table10();
     $t->createRoot();
     $this->assertEquals($t->getLeftValue(), 1, 'createRoot() is an alias for makeRoot()');
     $this->assertEquals($t->getRightValue(), 2, 'createRoot() is an alias for makeRoot()');
     $this->assertEquals($t->getLevel(), 0, 'createRoot() is an alias for makeRoot()');
 }