예제 #1
0
 /**
  * @covers Kunstmaan\AdminBundle\Helper\Menu\MenuItem::getChildren
  */
 public function testGetChildren()
 {
     $child1 = new MenuItem($this->object->getMenu());
     $child1->setAppearInNavigation(true);
     $child2 = new MenuItem($this->object->getMenu());
     $child2->setAppearInNavigation(true);
     $children = array($child1, $child2);
     $menuBuilder = $this->getMockBuilder('Kunstmaan\\AdminBundle\\Helper\\Menu\\MenuBuilder')->disableOriginalConstructor()->getMock();
     $menuBuilder->expects($this->once())->method('getChildren')->will($this->returnValue($children));
     /* @var $menuBuilder MenuBuilder */
     $parent = new MenuItem($menuBuilder);
     $result = $parent->getChildren();
     $this->assertEquals(2, count($result));
     $this->assertEquals($children, $result);
 }