public function testExecuteNullProduct() { $this->productMock->expects($this->once())->method('load')->with(59)->willReturn($this->productMock); $this->productModelFactoryMock->expects($this->once())->method('create')->willReturn($this->productMock); $this->swatchHelperMock->expects($this->once())->method('getAttributesFromConfigurable')->with($this->productMock)->willReturn([$this->attributeMock]); $this->swatchHelperMock->expects($this->once())->method('loadVariationByFallback')->with($this->productMock, ['size' => 454])->willReturn(null); $this->swatchHelperMock->expects($this->once())->method('getProductMediaGallery')->with($this->productMock)->willReturn($this->mediaGallery); $this->jsonMock->expects($this->once())->method('setData')->with($this->mediaGallery)->will($this->returnSelf()); $result = $this->controller->execute(); $this->assertInstanceOf('\\Magento\\Framework\\Controller\\Result\\Json', $result); }
/** * {@inheritdoc} */ public function execute() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'execute'); if (!$pluginInfo) { return parent::execute(); } else { return $this->___callPlugins('execute', func_get_args(), $pluginInfo); } }