Esempio n. 1
0
 /**
  * Tests that nested rules are properly executed.
  *
  * @covers ::execute
  */
 public function testNestedRules()
 {
     $this->testActionExpression->executeWithState(Argument::type(ExecutionStateInterface::class))->shouldBeCalledTimes(1);
     $nested = new Rule([], 'rules_rule', [], $this->expressionManager->reveal());
     // We need to replace the action and conditon container to not have the same
     // instances as in the outer rule.
     $nested->setConditions(new RulesAnd([], 'rules_and', [], $this->expressionManager->reveal()));
     $nested->setActions(new ActionSet([], 'rules_action_set', [], $this->expressionManager->reveal()));
     $nested->addExpressionObject($this->trueConditionExpression->reveal())->addExpressionObject($this->testActionExpression->reveal());
     $this->rule->addExpressionObject($this->trueConditionExpression->reveal())->addExpressionObject($nested)->execute();
 }