function WildcardConfigActionsTest::testInvalidExpression

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Recipe/WildcardConfigActionsTest.php \Drupal\KernelTests\Core\Recipe\WildcardConfigActionsTest::testInvalidExpression()

Tests that an invalid wildcard expression will raise an error.

@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."] ["field.field.node.*.body/", " could not be parsed."]

File

core/tests/Drupal/KernelTests/Core/Recipe/WildcardConfigActionsTest.php, line 127

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

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.