public function testExecute()
 {
     $product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)->disableOriginalConstructor()->setMethods(['_wakeup', 'getId'])->getMock();
     $this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product);
     $resultLayout = $this->getMock(\Magento\Framework\View\Result\Layout::class, [], [], '', false);
     $this->resultFactory->expects($this->once())->method('create')->with(ResultFactory::TYPE_LAYOUT)->willReturn($resultLayout);
     $this->assertInstanceOf(\Magento\Framework\View\Result\Layout::class, $this->controller->execute());
 }
 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\\ConfigurableProduct\\Block\\Adminhtml\\Product\\Attribute\\NewAttribute\\Product\\Created')->disableOriginalConstructor()->setMethods(['setIndex', 'toHtml'])->getMock();
     $this->view->expects($this->once())->method('loadLayout')->with('popup')->willReturnSelf();
     $this->productBuilder->expects($this->once())->method('build')->with($this->request)->willReturn($product);
     $this->view->expects($this->any())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('createBlock')->willReturn($block);
     $layout->expects($this->once())->method('setChild')->willReturnSelf();
     $this->view->expects($this->any())->method('renderLayout')->willReturnSelf();
     $this->controller->execute();
 }
示例#3
0
 /**
  * {@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);
     }
 }