/**
  *  @dataProvider getMenuTests
  */
 public function testGet($menuRoot, $name, $expectedPath)
 {
     $objectManager = $this->getDmMock($expectedPath);
     $objectManager->expects($this->once())->method('find')->with($this->equalTo(null), $this->equalTo($expectedPath))->will($this->returnValue($this->getMock('Knp\\Menu\\NodeInterface')));
     $managerRegistry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $managerRegistry->expects($this->once())->method('getManager')->will($this->returnValue($objectManager));
     $factory = $this->getMock('Knp\\Menu\\FactoryInterface');
     $factory->expects($this->once())->method('createFromNode')->will($this->returnValue($this->getMock('Knp\\Menu\\ItemInterface')));
     $provider = new PhpcrMenuProvider($factory, $managerRegistry, $menuRoot);
     $provider->setRequest($this->getMock('Symfony\\Component\\HttpFoundation\\Request'));
     $provider->get($name);
 }
Пример #2
0
 public function get($name, array $options = array())
 {
     //get the internal pages of the website
     $menu = parent::get($name, $options);
     if ($name === 'simple') {
         //Home menu item
         $item = new MenuItem('Home', $this->factory);
         $item->setUri($menu->getUri());
         $menu->addChild($item);
         $item->moveToFirstPosition();
     }
     return $menu;
 }