function LoopTest::testMissingList

Tests that a loop must have a list configured.

File

tests/src/Unit/Integration/Engine/LoopTest.php, line 211

Class

LoopTest
Test Rules execution with the loop plugin.

Namespace

Drupal\Tests\rules\Unit\Integration\Engine

Code

public function testMissingList() {
    $rule = $this->rulesExpressionManager
        ->createRule();
    // Empty loop configuration, 'list' is missing.
    $loop = $this->rulesExpressionManager
        ->createInstance('rules_loop', []);
    $rule->addExpressionObject($loop);
    $violations = RulesComponent::create($rule)->checkIntegrity();
    $this->assertCount(1, $violations);
    $this->assertEquals('List variable is missing.', (string) $violations[0]->getMessage());
}