You are here

public function RulesConditionContainerTest::testLookupNestedExpression in Rules 8.3

Tests that a nested expression can be retrieved by UUID.

File

tests/src/Unit/RulesConditionContainerTest.php, line 101

Class

RulesConditionContainerTest
@coversDefaultClass \Drupal\rules\Engine\ConditionExpressionContainer @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

public function testLookupNestedExpression() {
  $container = $this
    ->getMockForAbstractClass(RulesConditionContainerTestStub::class, [
    [],
    'test_id',
    [],
    $this
      ->prophesize(ExpressionManagerInterface::class)
      ->reveal(),
    $this
      ->prophesize(LoggerChannelInterface::class)
      ->reveal(),
  ], '', TRUE);
  $container
    ->addExpressionObject($this->trueConditionExpression
    ->reveal());
  $nested_container = $this
    ->getMockForAbstractClass(RulesConditionContainerTestStub::class, [
    [],
    'test_id',
    [],
    $this
      ->prophesize(ExpressionManagerInterface::class)
      ->reveal(),
    $this
      ->prophesize(LoggerChannelInterface::class)
      ->reveal(),
  ], '', TRUE);
  $nested_container
    ->addExpressionObject($this->falseConditionExpression
    ->reveal());
  $container
    ->addExpressionObject($nested_container);
  $uuid = $this->falseConditionExpression
    ->reveal()
    ->getUuid();
  $this
    ->assertSame($this->falseConditionExpression
    ->reveal(), $container
    ->getExpression($uuid));
}