Example #1
0
 /**
  * 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();
 }
Example #2
0
 /**
  * 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 afterSave()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'afterSave');
     if (!$pluginInfo) {
         return parent::afterSave();
     } else {
         return $this->___callPlugins('afterSave', func_get_args(), $pluginInfo);
     }
 }