Sonata\Tests\ProductBundle\Menu\ProductMenuBuilderTest::testCreateCategoryMenu PHP Method

testCreateCategoryMenu() public method

    public function testCreateCategoryMenu()
    {
        $menu = $this->getMock('Knp\\Menu\\ItemInterface');
        $factory = $this->getMock('Knp\\Menu\\FactoryInterface');
        $factory->expects($this->once())->method('createItem')->will($this->returnValue($menu));
        $categoryManager = $this->getMock('Sonata\\Component\\Product\\ProductCategoryManagerInterface');
        $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
        $categoryManager->expects($this->once())->method('getCategoryTree')->will($this->returnValue(array()));
        $builder = new ProductMenuBuilder($factory, $categoryManager, $router);
        $genMenu = $builder->createCategoryMenu();
        $this->assertInstanceOf('Knp\\Menu\\ItemInterface', $genMenu);
    }