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

getPathAsString() public method

e.g. Top Level 1 > Second Level > This menu
public getPathAsString ( Knp\Menu\ItemInterface $menu, string $separator = ' > ' ) : string
$menu Knp\Menu\ItemInterface
$separator string
return string
    public function getPathAsString(ItemInterface $menu, $separator = ' > ')
    {
        return $this->menuManipulator->getPathAsString($menu, $separator);
    }

Usage Example

 public function testPathAsString()
 {
     $menu = $this->getMock('Knp\\Menu\\ItemInterface');
     $manipulatorMock = $this->getManipulatorMock(array('getPathAsString'));
     $manipulatorMock->expects($this->any())->method('getPathAsString')->with($menu)->will($this->returnValue('A > B'));
     $helper = new MenuHelper($this->getHelperMock(), $this->getMatcherMock(), $manipulatorMock);
     $this->assertEquals('A > B', $helper->getPathAsString($menu));
 }