function IntegrityCheckTest::testMissingAction

Tests that a missing action plugin ID results in a violation.

File

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

Class

IntegrityCheckTest
Test the integrity check functionality during configuration time.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testMissingAction() {
    $rule = $this->rulesExpressionManager
        ->createRule();
    $action = $this->rulesExpressionManager
        ->createAction('');
    $rule->addExpressionObject($action);
    $violations = RulesComponent::create($rule)->checkIntegrity();
    $this->assertCount(1, $violations);
    $this->assertEquals('Action plugin ID is missing', (string) $violations[0]->getMessage());
    $this->assertEquals($action->getUuid(), $violations[0]->getUuid());
}