Knp\Bundle\MenuBundle\Templating\Helper\MenuHelper::isAncestor PHP Method

isAncestor() public method

Checks whether an item is the ancestor of a current item.
public isAncestor ( Knp\Menu\ItemInterface $item, integer $depth = null ) : boolean
$item Knp\Menu\ItemInterface
$depth integer The max depth to look for the item
return boolean
    public function isAncestor(ItemInterface $item, $depth = null)
    {
        return $this->matcher->isAncestor($item, $depth);
    }

Usage Example

Example #1
0
 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));
 }