Example #1
0
 /**
  * Tests that nested action sets work.
  */
 public function testNestedActionExecution()
 {
     // The method on the test action must be called twice.
     $this->testActionExpression->executeWithState(Argument::type(RulesStateInterface::class))->shouldBeCalledTimes(2);
     $inner = new ActionSet([], '', [], $this->expressionManager->reveal());
     $inner->addExpressionObject($this->testActionExpression->reveal());
     $this->actionSet->addExpressionObject($this->testActionExpression->reveal())->addExpressionObject($inner)->execute();
 }
Example #2
0
 /**
  * Tests deleting an action from the container.
  */
 public function testDeletingAction()
 {
     $this->actionSet->addExpressionObject($this->testActionExpression->reveal());
     $second_action = $this->prophesize(RulesAction::class);
     $this->actionSet->addExpressionObject($second_action->reveal());
     // Get the UUID of the first action added.
     $uuid = $this->testActionExpression->reveal()->getUuid();
     $this->assertTrue($this->actionSet->deleteExpression($uuid));
     // Now only the second action remains.
     foreach ($this->actionSet as $action) {
         $this->assertSame($second_action->reveal(), $action);
     }
 }