예제 #1
0
파일: RuleTest.php 프로젝트: nja78/magento2
 /**
  * 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();
 }
예제 #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());
 }
예제 #3
0
 /**
  * {@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);
     }
 }