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(); }
/** * @param \Magento\SalesRule\Model\Rule $ruleModel * @param RuleDataModel $dataModel * @return $this */ protected function mapActionConditions(\Magento\SalesRule\Model\Rule $ruleModel, RuleDataModel $dataModel) { $condition = $dataModel->getActionCondition(); if ($condition) { $array = $this->dataModelToArray($condition, 'actions'); $ruleModel->getActions()->setActions([])->loadArray($array, 'actions'); } return $this; }
/** * {@inheritdoc} */ public function getActions() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getActions'); if (!$pluginInfo) { return parent::getActions(); } else { return $this->___callPlugins('getActions', func_get_args(), $pluginInfo); } }