function ConfigActionValidationTest::testConfigActionMissingDependency

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Recipe/ConfigActionValidationTest.php \Drupal\KernelTests\Core\Recipe\ConfigActionValidationTest::testConfigActionMissingDependency()

Tests config action validation for missing dependency.

File

core/tests/Drupal/KernelTests/Core/Recipe/ConfigActionValidationTest.php, line 115

Class

ConfigActionValidationTest
@group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testConfigActionMissingDependency() : void {
    $recipe_data = <<<YAML
name: Config actions making bad decisions
config:
  actions:
    random.config:
      simpleConfigUpdate:
        label: ''
YAML;
    try {
        $this->createRecipe($recipe_data);
        $this->fail('An exception should have been thrown.');
    } catch (RecipeFileException $e) {
        $this->assertIsObject($e->violations);
        $this->assertCount(1, $e->violations);
        $this->assertSame('[config][actions][random.config]', $e->violations[0]
            ->getPropertyPath());
        $this->assertSame("Config actions cannot be applied to random.config because the random extension is not installed, and is not installed by this recipe or any of the recipes it depends on.", (string) $e->violations[0]
            ->getMessage());
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.