public function testAfterLoadNoLinks() { $options = $this->setupOptions(); $this->productMock->expects($this->once())->method('getTypeId')->willReturn(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE); $extensionAttributeMock = $this->getMockBuilder('\\Magento\\Catalog\\Api\\Data\\ProductExtension')->setMethods(['setConfigurableProductOptions', 'setConfigurableProductLinks'])->getMock(); $extensionAttributeMock->expects($this->once())->method('setConfigurableProductOptions')->with($options)->willReturnSelf(); $extensionAttributeMock->expects($this->once())->method('setConfigurableProductLinks')->with([])->willReturnSelf(); $this->productExtensionFactory->expects($this->once())->method('create')->willReturn($extensionAttributeMock); $this->productMock->expects($this->once())->method('setExtensionAttributes')->with($extensionAttributeMock)->willReturnSelf(); $this->assertEquals($this->productMock, $this->model->afterLoad($this->productMock)); }
/** * Creates and returns product image complete url * @param Magento\Catalog\Model\Product $product * @return string */ function getProductImageUrl($product) { return $this->getMediaBaseUrl() . 'catalog/product' . $product->getImage(); }