function RulesConditionContainerTest::testLookupExpression

Tests that an expression can be retrieved by UUID.

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit

Code

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