public function testExecute() { $product = $this->getMockBuilder('\\Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->setMethods(['_wakeup', 'getId'])->getMock(); $layout = $this->getMock('\\Magento\\Framework\\View\\LayoutInterface'); $block = $this->getMockBuilder('Magento\\Bundle\\Block\\Adminhtml\\Catalog\\Product\\Edit\\Tab\\Bundle')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock(); $this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product); $this->initializationHelper->expects($this->any())->method('initialize')->willReturn($product); $this->response->expects($this->once())->method('setBody')->willReturnSelf(); $this->view->expects($this->once())->method('getLayout')->willReturn($layout); $layout->expects($this->once())->method('createBlock')->willReturn($block); $block->expects($this->once())->method('toHtml')->willReturnSelf(); $this->controller->execute(); }
/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }