/** * @param bool $hasAllowedProcessor * * @dataProvider getBuildDataProvider */ public function testBuild($hasAllowedProcessor) { $this->componentRegistry->expects($this->once())->method('hasAllowedProcessor')->willReturn($hasAllowedProcessor); /** @var \PHPUnit_Framework_MockObject_MockObject|\Knp\Menu\ItemInterface $menu */ $menu = $this->getMock('Knp\\Menu\\ItemInterface'); if ($hasAllowedProcessor) { $menu->expects($this->once())->method('addChild')->with('orob2b.product.frontend.quick_add.title', ['route' => 'orob2b_product_frontend_quick_add', 'extras' => ['position' => 500, 'description' => 'orob2b.product.frontend.quick_add.description']]); } $this->builder->build($menu); }
/** * @param bool $isValidationRequired * @param bool $isAllowed * @return \PHPUnit_Framework_MockObject_MockObject|ComponentProcessorInterface */ protected function getProcessor($isValidationRequired = true, $isAllowed = true) { $processor = $this->getMock('OroB2B\\Bundle\\ProductBundle\\Model\\ComponentProcessorInterface'); $processor->expects($this->any())->method('isValidationRequired')->willReturn($isValidationRequired); $processor->expects($this->any())->method('isAllowed')->willReturn($isAllowed); $this->componentRegistry->expects($this->once())->method('getProcessorByName')->with(self::COMPONENT_NAME)->willReturn($processor); return $processor; }