public function LoopTest::testMissingList in Rules 8.3
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\EngineCode
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
->assertEquals(1, iterator_count($violations));
$this
->assertEquals('List variable is missing.', (string) $violations[0]
->getMessage());
}