Beispiel #1
0
 /**
  * @param $fixtureId
  * @param bool $save
  * @throws \Magefix\Exceptions\ProductMediaGalleryImageNotFound
  */
 protected function _addMediaGalleryImage($fixtureId, $save = true)
 {
     if ($this->_hasMediaGallery()) {
         MagentoStoreScope::setAdminStoreScope();
         $product = $this->_getMageModel()->load($fixtureId);
         if ($product) {
             MediaGalleryImage::save($product, $this->_getMediaGallery(), $save);
         }
         MagentoStoreScope::setCurrentStoreScope();
     }
 }
Beispiel #2
0
 /**
  * @return mixed
  * @throws \Exception
  */
 protected function _saveFixture()
 {
     MagentoStoreScope::setAdminStoreScope();
     $this->_getMageModel()->setCanSaveCustomOptions(true);
     $this->_getMageModel()->setCanSaveBundleSelections(true);
     $this->_getMageModel()->setAffectBundleProductSelections(true);
     Mage::register('product', $this->_getMageModel());
     $this->_buildBundleProductsFixtures();
     $this->_setBundleOptions();
     $this->_getMageModel()->setBundleOptionsData($this->_bundleOptions);
     $this->_setBundleSelections();
     $this->_getMageModel()->setBundleSelectionsData($this->_bundleSelections);
     $this->_addMediaGalleryImage($this->_getMageModel()->getId(), false);
     $fixture = $this->_getMageModel()->save();
     MagentoStoreScope::setCurrentStoreScope();
     return $fixture->getId();
 }
Beispiel #3
0
 /**
  * @param MagentoModel $mageModel
  * @param $data
  * @return mixed
  * @throws \Exception
  */
 protected function _saveFixtureWithModelAndData(MagentoModel $mageModel, $data)
 {
     MagentoStoreScope::setAdminStoreScope();
     $mageModel->setData($data);
     $mageModel->save();
     MagentoStoreScope::setCurrentStoreScope();
     return $mageModel->getId();
 }
Beispiel #4
0
 /**
  * @param string feature|scenario|step $hook
  */
 protected static function _cleanupFixtureByHook($hook)
 {
     $registry = self::_getBuilderRegistry();
     $registryIterator = new RegistryIterator($registry);
     MagentoStoreScope::setAdminStoreScope();
     $registryIterator->iterateByHook($hook);
     MagentoStoreScope::setCurrentStoreScope();
 }