function _testQueryPathNodeRoot() { // get class map of eptAuthor $this->assertTrue($cm = $this->m->getClassMap('eptAuthor')); // create alias generator $this->assertTrue($am = new epQueryAliasManager()); // create a root node $this->assertTrue($root = new epQueryPathRoot($cm, $alias = false, epQueryPathRoot::PRIMARY, $am)); // check if class map is set $this->assertTrue($cm === $root->getMap()); // check if alias is set $this->assertTrue($alias = $am->getClassAlias('eptAuthor')); $this->assertTrue($alias == $root->getAlias()); // --- 1 --- // test find last node on path .contact.zipcode $this->assertFalse($node1 = $root->findNode('.contact.zipcode')); // insert the path to root $this->assertTrue($node1 = $root->insertPath('.contact.zipcode')); // returned node should be epQueryPathField $this->assertTrue($node1 instanceof epQueryPathField); $this->assertTrue($node1->getName() == 'zipcode'); $this->assertTrue($node1->getMap()->getName() == 'zipcode'); $this->assertTrue($node1->getParent()->getName() == 'contact'); $this->assertTrue($node1->getParent()->getMap()->getName() == 'contact'); // test findNode again $this->assertTrue($node1 = $root->findNode('.contact.zipcode')); $this->assertTrue($node1 instanceof epQueryPathField); $this->assertTrue($node1->getName() == 'zipcode'); $this->assertTrue($node1->getMap()->getName() == 'zipcode'); $this->assertTrue($node1->getParent()->getName() == 'contact'); $this->assertTrue($node1->getParent()->getMap()->getName() == 'contact'); // --- 2 --- // test find last node on path .contact.phone $this->assertFalse($node2 = $root->findNode('.contact.phone')); // insert the path to root $this->assertTrue($node2 = $root->insertPath('.contact.phone')); // returned node should be epQueryPathField $this->assertTrue($node2 instanceof epQueryPathField); $this->assertTrue($node2->getName() == 'phone'); $this->assertTrue($node2->getMap()->getName() == 'phone'); $this->assertTrue($node2->getParent()->getName() == 'contact'); $this->assertTrue($node2->getParent()->getMap()->getName() == 'contact'); // test findNode again $this->assertTrue($node2 = $root->findNode('.contact.phone')); $this->assertTrue($node2 instanceof epQueryPathField); $this->assertTrue($node2->getName() == 'phone'); $this->assertTrue($node2->getMap()->getName() == 'phone'); $this->assertTrue($node2->getParent()->getName() == 'contact'); $this->assertTrue($node2->getParent()->getMap()->getName() == 'contact'); // the two paths should share .contact $this->assertTrue(($parent =& $node1->getParent()) === $node2->getParent()); $this->assertTrue(2 == count($parent->getChildren())); $this->assertTrue($node1 === $parent->getChild('zipcode')); $this->assertTrue($node2 === $parent->getChild('phone')); }