function IntegrityCheckTest::testMissingCondition
Tests that a missing condition plugin ID results in a violation.
File
-
tests/
src/ Unit/ Integration/ Engine/ IntegrityCheckTest.php, line 104
Class
- IntegrityCheckTest
- Test the integrity check functionality during configuration time.
Namespace
Drupal\Tests\rules\Unit\Integration\EngineCode
public function testMissingCondition() {
$rule = $this->rulesExpressionManager
->createRule();
$condition = $this->rulesExpressionManager
->createCondition('');
$rule->addExpressionObject($condition);
$violations = RulesComponent::create($rule)->checkIntegrity();
$this->assertCount(1, $violations);
$this->assertEquals('Condition plugin ID is missing', (string) $violations[0]->getMessage());
$this->assertEquals($condition->getUuid(), $violations[0]->getUuid());
}