Esempio n. 1
1
 /**
  * @depends testAfterSave
  */
 public function testAfterSaveEmpty()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->setCurrentStore(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore(\Magento\Store\Model\Store::DEFAULT_STORE_ID));
     /** @var $product \Magento\Catalog\Model\Product */
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $product->load(1);
     $product->setOrigData();
     $product->setTierPrice([]);
     $this->_model->afterSave($product);
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $product->setId(1);
     $this->_model->afterLoad($product);
     $this->assertEmpty($product->getTierPrice());
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function validate($object)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'validate');
     if (!$pluginInfo) {
         return parent::validate($object);
     } else {
         return $this->___callPlugins('validate', func_get_args(), $pluginInfo);
     }
 }
 /**
  * @depends testAfterSave
  */
 public function testAfterSaveEmpty()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->setCurrentStore(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore(\Magento\Store\Model\Store::DEFAULT_STORE_ID));
     /** @var $product \Magento\Catalog\Model\Product */
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $product->load($this->productRepository->get('simple')->getId());
     $product->setOrigData();
     $product->setTierPrice([]);
     $this->_model->afterSave($product);
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $fixtureProduct = $this->productRepository->get('simple');
     $product->setId($fixtureProduct->getId());
     $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
     $product->setData($linkField, $fixtureProduct->getData($linkField));
     $this->_model->afterLoad($product);
     $this->assertEmpty($product->getTierPrice());
 }