/** * {@inheritdoc} */ public function getImage($product, $imageId, $attributes = array()) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage'); if (!$pluginInfo) { return parent::getImage($product, $imageId, $attributes); } else { return $this->___callPlugins('getImage', func_get_args(), $pluginInfo); } }
/** * @covers Magento\Swatches\Block\Product\Renderer\Listing\Configurable::getSwatchAttributesData */ public function testGetJsonSwatchUsedInProductListing() { $products = [1 => 'testA', 3 => 'testB']; $expected = ['type' => null, 'value' => 'hello', 'label' => $products[3]]; $this->prepareGetJsonSwatchConfig(); $this->configurable->setProduct($this->product); $this->swatchHelper->expects($this->once())->method('getSwatchAttributesAsArray')->with($this->product)->willReturn([1 => ['options' => $products, 'use_product_image_for_swatch' => true, 'used_in_product_listing' => true, 'attribute_code' => 'code']]); $this->swatchHelper->expects($this->once())->method('getSwatchesByOptionsId')->with([1, 3])->willReturn([3 => ['type' => $expected['type'], 'value' => $expected['value']]]); $this->jsonEncoder->expects($this->once())->method('encode'); $this->configurable->getJsonSwatchConfig(); }
public function testGetMediaCallback() { $this->urlBuilder->expects($this->once())->method('getBaseUrl')->willReturn('http://magento.com/'); $this->assertContains(Configurable::MEDIA_CALLBACK_ACTION, $this->configurable->getMediaCallback()); }
/** * {@inheritdoc} */ public function offsetGet($offset) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet'); if (!$pluginInfo) { return parent::offsetGet($offset); } else { return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo); } }
public function testGetMediaCallback() { $url = 'http://localhost/' . Configurable::MEDIA_CALLBACK_ACTION; $this->urlBuilder->expects($this->once())->method('getUrl')->with(Configurable::MEDIA_CALLBACK_ACTION)->willReturn($url); $this->assertEquals($url, $this->configurable->getMediaCallback()); }
/** * Composes configuration for js * * @return string */ public function getJsonConfig() { $this->unsetData('allow_products'); return parent::getJsonConfig(); }