public function testCatalogAttributeSaveAfter() { $attributeCode = 'attributeCode'; $observer = $this->getMock('Magento\\Framework\\Event\\Observer', [], [], '', false); $event = $this->getMock('Magento\\Framework\\Event', ['getAttribute', '__wakeup'], [], '', false); $attribute = $this->getMock('Magento\\Catalog\\Model\\Resource\\Eav\\Attribute', ['dataHasChangedFor', 'getIsUsedForPromoRules', 'getAttributeCode', '__wakeup'], [], '', false); $observer->expects($this->once())->method('getEvent')->will($this->returnValue($event)); $event->expects($this->any())->method('getAttribute')->will($this->returnValue($attribute)); $attribute->expects($this->any())->method('dataHasChangedFor')->with('is_used_for_promo_rules')->will($this->returnValue(true)); $attribute->expects($this->any())->method('getIsUsedForPromoRules')->will($this->returnValue(false)); $attribute->expects($this->any())->method('getAttributeCode')->will($this->returnValue($attributeCode)); $this->checkSalesRuleAvailability($attributeCode); $this->assertEquals($this->model, $this->model->catalogAttributeSaveAfter($observer)); }