Inheritance: extends Symfony\Component\Templating\Helper\Helper
Example #1
0
 public function testGetCurrentItem()
 {
     $menu = $this->getMock('Knp\\Menu\\ItemInterface');
     $helperMock = $this->getHelperMock(array('getCurrentItem'));
     $helperMock->expects($this->any())->method('getCurrentItem')->with('default')->will($this->returnValue($menu));
     $helper = new MenuHelper($helperMock, $this->getMatcherMock(), $this->getManipulatorMock());
     $this->assertEquals($menu, $helper->getCurrentItem('default'));
 }
 public function testIsAncestor()
 {
     $menu = $this->getMock('Knp\\Menu\\ItemInterface');
     $matcherMock = $this->getMatcherMock();
     $matcherMock->expects($this->any())->method('isAncestor')->with($menu)->will($this->returnValue(false));
     $helper = new MenuHelper($this->getHelperMock(), $matcherMock, $this->getManipulatorMock());
     $this->assertFalse($helper->isAncestor($menu));
 }
 public function testGetName()
 {
     $helperMock = $this->getMockBuilder('Knp\\Menu\\Twig\\Helper')->disableOriginalConstructor()->getMock();
     $helper = new MenuHelper($helperMock);
     $this->assertEquals('knp_menu', $helper->getName());
 }
 /**
  * @param string $name
  * @param integer $depth (optional)
  * @return string
  */
 public function render($name, $depth = null, $template = null)
 {
     return $this->helper->render($name, $depth, $template);
 }