Author: Hugo Briand (briand@ekino.com)
 /**
  * {@inheritdoc}
  */
 protected function getMenu(BlockContextInterface $blockContext)
 {
     $settings = $blockContext->getSettings();
     $menu = parent::getMenu($blockContext);
     if (null === $menu || '' === $menu) {
         $menu = $this->menuBuilder->createFiltersMenu($settings['product_provider'], array('childrenAttributes' => array('class' => $settings['menu_class'])), $settings['current_uri']);
     }
     return $menu;
 }
 /**
  * {@inheritdoc}
  */
 protected function getMenu(BlockContextInterface $blockContext)
 {
     $settings = $blockContext->getSettings();
     $menu = parent::getMenu($blockContext);
     if (null === $menu || "" === $menu) {
         $menu = $this->menuBuilder->createCategoryMenu(array('childrenAttributes' => array('class' => $settings['menu_class']), 'attributes' => array('class' => $settings['children_class'])), $settings['current_uri']);
     }
     return $menu;
 }
 public function testCreateFiltersMenu()
 {
     $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');
     $builder = new ProductMenuBuilder($factory, $categoryManager, $router);
     $productProvider = $this->getMock('Sonata\\Component\\Product\\ProductProviderInterface');
     $productProvider->expects($this->once())->method('getFilters')->will($this->returnValue(array()));
     $genMenu = $builder->createFiltersMenu($productProvider);
     $this->assertInstanceOf('Knp\\Menu\\ItemInterface', $genMenu);
 }