Beispiel #1
0
 public function testHasChildren()
 {
     $n1 = new Node("h-1", "n1", null);
     $n2 = $n1->addChild(new Node("h-1-1", "n2", null));
     $this->assertTrue($n1->hasChildren(), "Se esperaba que el nodo contenga hijos.");
     $n1 = new Node("h-1", "n1", null);
     $this->assertFalse($n1->hasChildren(), "Se esperaba que el nodo no contenga hijos.");
 }
 protected function buildMenuItemFromSitemapNode(MenuItem $menu, Node $node)
 {
     foreach ($node->getChildren() as $childNode) {
         if ($childNode->isNavigable()) {
             $subMenu = $menu->addChild($childNode->getName(), $childNode->getLabel(), $childNode->getLocation());
             $this->buildMenuItemFromSitemapNode($subMenu, $childNode);
         }
     }
 }