You are here

public function IntegrityCheckTest::testInvalidCondition in Rules 8.3

Tests that an invalid condition plugin ID results in a violation.

File

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

Class

IntegrityCheckTest
Test the integrity check functionality during configuration time.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testInvalidCondition() {
  $rule = $this->rulesExpressionManager
    ->createRule();
  $condition = $this->rulesExpressionManager
    ->createCondition('invalid_condition_id');
  $rule
    ->addExpressionObject($condition);
  $violations = RulesComponent::create($rule)
    ->checkIntegrity();
  $this
    ->assertEquals(1, iterator_count($violations));
  $this
    ->assertEquals('Condition plugin <em class="placeholder">invalid_condition_id</em> does not exist', (string) $violations[0]
    ->getMessage());
  $this
    ->assertEquals($condition
    ->getUuid(), $violations[0]
    ->getUuid());
}