You are here

public function RuleExpressionTest::testLookupExpression in Rules 8.3

Tests that a nested expression can be retrieved by UUID.

File

tests/src/Unit/RuleExpressionTest.php, line 210

Class

RuleExpressionTest
@coversDefaultClass \Drupal\rules\Plugin\RulesExpression\RuleExpression @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

public function testLookupExpression() {

  // Test Conditions.
  $this->rule
    ->addExpressionObject($this->trueConditionExpression
    ->reveal());
  $uuid = $this->trueConditionExpression
    ->reveal()
    ->getUuid();
  $this
    ->assertSame($this->trueConditionExpression
    ->reveal(), $this->rule
    ->getExpression($uuid));

  // Test actions.
  $this->rule
    ->addExpressionObject($this->testActionExpression
    ->reveal());
  $uuid = $this->testActionExpression
    ->reveal()
    ->getUuid();
  $this
    ->assertSame($this->testActionExpression
    ->reveal(), $this->rule
    ->getExpression($uuid));
  $this
    ->assertFalse($this->rule
    ->getExpression('invalid UUID'));
}