You are here

public function IntegrityCheckTest::testRefinedContextViolation in Rules 8.3

Tests that refined context is respected when checking context.

File

tests/src/Unit/Integration/Engine/IntegrityCheckTest.php, line 354

Class

IntegrityCheckTest
Test the integrity check functionality during configuration time.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testRefinedContextViolation() {
  $rule = $this->rulesExpressionManager
    ->createRule();
  $rule
    ->addAction('rules_variable_add', ContextConfig::create()
    ->setValue('type', 'integer')
    ->map('value', 'text'));
  $violation_list = RulesComponent::create($rule)
    ->addContextDefinition('text', ContextDefinition::create('string'))
    ->checkIntegrity();
  $this
    ->assertEquals(1, iterator_count($violation_list));
}