function IntegrityCheckTest::testInvalidAction

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

File

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

Class

IntegrityCheckTest
Test the integrity check functionality during configuration time.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testInvalidAction() {
    $rule = $this->rulesExpressionManager
        ->createRule();
    $action = $this->rulesExpressionManager
        ->createAction('invalid_action_id');
    $rule->addExpressionObject($action);
    $violations = RulesComponent::create($rule)->checkIntegrity();
    $this->assertCount(1, $violations);
    $this->assertEquals('Action plugin <em class="placeholder">invalid_action_id</em> does not exist', (string) $violations[0]->getMessage());
    $this->assertEquals($action->getUuid(), $violations[0]->getUuid());
}