You are here

public function RulesComponentTest::testGetContextDefinitions in Rules 8.3

@covers ::getContextDefinitions

File

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

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);
}