function RulesComponentTest::testGetContextDefinitions

@covers ::getContextDefinitions

File

tests/src/Unit/Integration/Engine/RulesComponentTest.php, line 52

Class

RulesComponentTest
Tests the Rules component class.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testGetContextDefinitions() {
    $rule = $this->rulesExpressionManager
        ->createRule();
    $definition = ContextDefinition::create('string');
    $component = RulesComponent::create($rule)->addContextDefinition('test', $definition);
    $this->assertEquals(array_keys($component->getContextDefinitions()), [
        'test',
    ]);
    $this->assertSame($component->getContextDefinitions()['test'], $definition);
}