Namespace
Drupal\Tests\rules\Unit
File
-
tests/src/Unit/RulesUnitTestBase.php
View source
<?php
namespace Drupal\Tests\rules\Unit;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\rules\Context\ExecutionStateInterface;
use Drupal\rules\Engine\ActionExpressionInterface;
use Drupal\rules\Engine\ConditionExpressionInterface;
use Drupal\rules\Engine\ExpressionManagerInterface;
use Drupal\Tests\UnitTestCase;
use Prophecy\Argument;
abstract class RulesUnitTestBase extends UnitTestCase {
protected $trueConditionExpression;
protected $falseConditionExpression;
protected $testActionExpression;
protected $testFirstActionExpression;
protected $expressionManager;
protected $rulesDebugLogger;
protected function setUp() : void {
parent::setUp();
$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);
$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);
$this->testFirstActionExpression = $this->prophesize(ActionExpressionInterface::class);
$this->testFirstActionExpression
->getUuid()
->willReturn('action_uuid0');
$this->testFirstActionExpression
->getWeight()
->willReturn(-1);
$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);
}
}
Classes