/** * Test after update action * * @return void */ public function testAfterUpdate() { $this->rule->isObjectNew(false); $indexer = $this->getMock('\\Magento\\Indexer\\Model\\IndexerInterface'); $indexer->expects($this->once())->method('invalidate'); $this->_ruleProductProcessor->expects($this->once())->method('getIndexer')->will($this->returnValue($indexer)); $this->rule->afterSave(); }
/** * Test isRuleBehaviorChanged action * * @dataProvider isRuleBehaviorChangedDataProvider * * @param array $dataArray * @param array $originDataArray * @param bool $isObjectNew * @param bool $result * * @return void */ public function testIsRuleBehaviorChanged($dataArray, $originDataArray, $isObjectNew, $result) { $this->rule->setData('website_ids', []); $this->rule->isObjectNew($isObjectNew); $indexer = $this->getMock('\\Magento\\Framework\\Indexer\\IndexerInterface'); $indexer->expects($this->any())->method('invalidate'); $this->_ruleProductProcessor->expects($this->any())->method('getIndexer')->will($this->returnValue($indexer)); foreach ($dataArray as $data) { $this->rule->setData($data); } $this->rule->afterSave(); foreach ($originDataArray as $data) { $this->rule->setOrigData($data); } $this->assertEquals($result, $this->rule->isRuleBehaviorChanged()); }
/** * {@inheritdoc} */ public function isObjectNew($flag = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'isObjectNew'); if (!$pluginInfo) { return parent::isObjectNew($flag); } else { return $this->___callPlugins('isObjectNew', func_get_args(), $pluginInfo); } }