public function IntegrityCheckTest::testSelectorRestriction in Rules 8.3
Tests the data selector restriction on contexts.
File
- tests/
src/ Unit/ Integration/ Engine/ IntegrityCheckTest.php, line 191
Class
- IntegrityCheckTest
- Test the integrity check functionality during configuration time.
Namespace
Drupal\Tests\rules\Unit\Integration\EngineCode
public function testSelectorRestriction() {
$rule = $this->rulesExpressionManager
->createRule();
$action = $this->rulesExpressionManager
->createAction('rules_data_set', ContextConfig::create()
->setValue('data', 'some value')
->setValue('value', 'some new value'));
$rule
->addExpressionObject($action);
$violation_list = RulesComponent::create($rule)
->checkIntegrity();
$this
->assertEquals(1, iterator_count($violation_list));
$this
->assertEquals('The context <em class="placeholder">Data</em> may only be configured using a selector.', (string) $violation_list[0]
->getMessage());
$this
->assertEquals($action
->getUuid(), $violation_list[0]
->getUuid());
}