public function testUpdateImage() { $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product'); $product->setData('media_gallery', ['images' => ['image' => ['file' => 'magento_image.jpg']]]); $this->_model->updateImage($product, 'magento_image.jpg', ['label' => 'test label']); $this->assertEquals('test label', $product->getData('media_gallery/images/image/label')); }
/** * {@inheritdoc} */ public function updateImage(\Magento\Catalog\Model\Product $product, $file, $data) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'updateImage'); if (!$pluginInfo) { return parent::updateImage($product, $file, $data); } else { return $this->___callPlugins('updateImage', func_get_args(), $pluginInfo); } }