function WildcardConfigActionsTest::testInvalidExpression
Tests that an invalid wildcard expression will raise an error.
Attributes
#[TestWith([
"field.*.node.one.*",
"No installed config entity type uses the prefix in the expression 'field.*.node.one.*'. Either there is a typo in the expression or this recipe should install an additional module or depend on another recipe.",
])]
#[TestWith([
"field.field.node.*.body/",
" could not be parsed.",
])]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ WildcardConfigActionsTest.php, line 130
Class
- WildcardConfigActionsTest
- Tests config actions targeting multiple entities using wildcards.
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testInvalidExpression(string $expression, string $expected_exception_message) : void {
$contents = <<<YAML
name: 'Wildcards gone wild...'
config:
actions:
{<span class="php-variable">$expression</span>}:
simpleConfigUpdate:
label: 'Changed by config action'
YAML;
$recipe = $this->createRecipe($contents);
$this->expectException(ConfigActionException::class);
$this->expectExceptionMessage($expected_exception_message);
RecipeRunner::processRecipe($recipe);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.