Esempio n. 1
0
 public function testBeforeSaveResetConditionToNull()
 {
     $conditionMock = $this->setupConditionMock();
     //Make sure that we reset _condition in beforeSave method
     $this->conditionCombineFactoryMock->expects($this->exactly(2))->method('create')->willReturn($conditionMock);
     $prodConditionMock = $this->setupProdConditionMock();
     $this->condProdCombineFactoryMock->expects($this->exactly(2))->method('create')->willReturn($prodConditionMock);
     $this->model->beforeSave();
     $this->model->getConditions();
     $this->model->getActions();
 }
Esempio n. 2
0
 /**
  * @param \Magento\SalesRule\Model\Rule $ruleModel
  * @param RuleDataModel $dataModel
  * @return $this
  */
 protected function mapConditions(\Magento\SalesRule\Model\Rule $ruleModel, RuleDataModel $dataModel)
 {
     $condition = $dataModel->getCondition();
     if ($condition) {
         $array = $this->dataModelToArray($condition);
         $ruleModel->getConditions()->setConditions([])->loadArray($array);
     }
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function getConditions()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getConditions');
     if (!$pluginInfo) {
         return parent::getConditions();
     } else {
         return $this->___callPlugins('getConditions', func_get_args(), $pluginInfo);
     }
 }