public function testIndexerAfterSaveScopeChangeAttribute() { $this->_processor->expects($this->once())->method('markIndexerAsInvalid'); $this->_model->setOrigData('is_global', \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE); $this->_model->setOrigData('used_in_product_listing', 1); $this->_model->setIsGlobal(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL); $this->_model->afterSave(); }
/** * Redefine Attribute scope * * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute * @return $this */ public function setScope($attribute) { if ($this->_helper->isPriceGlobal()) { $attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_GLOBAL); } else { $attribute->setIsGlobal(ScopedAttributeInterface::SCOPE_WEBSITE); } return $this; }
/** * Redefine Attribute scope * * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute * @return $this */ public function setScope($attribute) { if ($this->_helper->isPriceGlobal()) { $attribute->setIsGlobal(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_GLOBAL); } else { $attribute->setIsGlobal(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_WEBSITE); } return $this; }