/** * {@inheritDoc} */ public function build(ItemInterface $menu, array $options = array(), $alias = null) { if (!$this->componentRegistry->hasAllowedProcessor()) { return; } $menu->addChild('orob2b.product.frontend.quick_add.title', ['route' => 'orob2b_product_frontend_quick_add', 'extras' => ['position' => 500, 'description' => 'orob2b.product.frontend.quick_add.description']]); }
public function testHasAllowedProcessor() { $processorAllowed = $this->getProcessorMock('allowed'); $processorDisallowed = $this->getProcessorMock('disallowed'); $registry = new ComponentProcessorRegistry(); $registry->addProcessor($processorAllowed); $registry->addProcessor($processorDisallowed); $this->assertFalse($registry->hasAllowedProcessor()); $processorAllowed->expects($this->once())->method('isAllowed')->willReturn(true); $this->assertTrue($registry->hasAllowedProcessor()); }