You are here

protected function RulesUnitTestBase::setUp in Rules 8.3

Overrides UnitTestCase::setUp

4 calls to RulesUnitTestBase::setUp()
ActionSetExpressionTest::setUp in tests/src/Unit/ActionSetExpressionTest.php
AndExpressionTest::setUp in tests/src/Unit/AndExpressionTest.php
OrExpressionTest::setUp in tests/src/Unit/OrExpressionTest.php
RuleExpressionTest::setUp in tests/src/Unit/RuleExpressionTest.php
4 methods override RulesUnitTestBase::setUp()
ActionSetExpressionTest::setUp in tests/src/Unit/ActionSetExpressionTest.php
AndExpressionTest::setUp in tests/src/Unit/AndExpressionTest.php
OrExpressionTest::setUp in tests/src/Unit/OrExpressionTest.php
RuleExpressionTest::setUp in tests/src/Unit/RuleExpressionTest.php

File

tests/src/Unit/RulesUnitTestBase.php, line 63

Class

RulesUnitTestBase
Helper class with mock objects.

Namespace

Drupal\Tests\rules\Unit

Code

protected function setUp() : void {
  parent::setUp();

  // A Condition that's always TRUE.
  $this->trueConditionExpression = $this
    ->prophesize(ConditionExpressionInterface::class);
  $this->trueConditionExpression
    ->getUuid()
    ->willReturn('true_uuid1');
  $this->trueConditionExpression
    ->getWeight()
    ->willReturn(0);
  $this->trueConditionExpression
    ->execute()
    ->willReturn(TRUE);
  $this->trueConditionExpression
    ->executeWithState(Argument::type(ExecutionStateInterface::class))
    ->willReturn(TRUE);

  // A Condition that's always FALSE.
  $this->falseConditionExpression = $this
    ->prophesize(ConditionExpressionInterface::class);
  $this->falseConditionExpression
    ->getUuid()
    ->willReturn('false_uuid1');
  $this->falseConditionExpression
    ->getWeight()
    ->willReturn(0);
  $this->falseConditionExpression
    ->execute()
    ->willReturn(FALSE);
  $this->falseConditionExpression
    ->executeWithState(Argument::type(ExecutionStateInterface::class))
    ->willReturn(FALSE);

  // An Action with a low weight.
  $this->testFirstActionExpression = $this
    ->prophesize(ActionExpressionInterface::class);
  $this->testFirstActionExpression
    ->getUuid()
    ->willReturn('action_uuid0');
  $this->testFirstActionExpression
    ->getWeight()
    ->willReturn(-1);

  // An Action with a heavier weight.
  $this->testActionExpression = $this
    ->prophesize(ActionExpressionInterface::class);
  $this->testActionExpression
    ->getUuid()
    ->willReturn('action_uuid1');
  $this->testActionExpression
    ->getWeight()
    ->willReturn(0);
  $this->expressionManager = $this
    ->prophesize(ExpressionManagerInterface::class);
  $this->rulesDebugLogger = $this
    ->prophesize(LoggerChannelInterface::class);
}