public function testAddImage() { $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product'); $product->setId(1); $file = $this->_model->addImage($product, self::$_mediaTmpDir . '/magento_small_image.jpg'); $this->assertStringMatchesFormat('/m/a/magento_small_image%sjpg', $file); }
/** * {@inheritdoc} */ public function addImage(\Magento\Catalog\Model\Product $product, $file, $mediaAttribute = null, $move = false, $exclude = true) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'addImage'); if (!$pluginInfo) { return parent::addImage($product, $file, $mediaAttribute, $move, $exclude); } else { return $this->___callPlugins('addImage', func_get_args(), $pluginInfo); } }