/**
  * @magentoDataFixture Magento/Store/_files/core_fixturestore.php
  * @magentoAppIsolation enabled
  * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1
  */
 public function testSetStoreIdWithNonNumericValue()
 {
     /** @var $store \Magento\Store\Model\Store */
     $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Store');
     $store->load('fixturestore');
     $this->assertNotEquals($this->_model->getStoreId(), $store->getId());
     $this->_model->setStoreId('fixturestore');
     $this->assertEquals($this->_model->getStoreId(), $store->getId());
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function afterSave()
 {
     if ($this->getScope() == 'stores') {
         $rootId = $this->getValue();
         $storeId = $this->getScopeId();
         $tree = $this->_catalogCategory->getTreeModel();
         // Create copy of categories attributes for choosed store
         $tree->load();
         $root = $tree->getNodeById($rootId);
         // Save root
         $this->_catalogCategory->setStoreId(0)->load($root->getId());
         $this->_catalogCategory->setStoreId($storeId)->save();
         foreach ($root->getAllChildNodes() as $node) {
             $this->_catalogCategory->setStoreId(0)->load($node->getId());
             $this->_catalogCategory->setStoreId($storeId)->save();
         }
     }
     return parent::afterSave();
 }
 /**
  * {@inheritdoc}
  */
 public function setStoreId($storeId)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setStoreId');
     if (!$pluginInfo) {
         return parent::setStoreId($storeId);
     } else {
         return $this->___callPlugins('setStoreId', func_get_args(), $pluginInfo);
     }
 }