/** * 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 setOrigData($key = null, $data = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setOrigData'); if (!$pluginInfo) { return parent::setOrigData($key, $data); } else { return $this->___callPlugins('setOrigData', func_get_args(), $pluginInfo); } }