function RecipeRunnerTest::testConfigFromModuleAndRecipe

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php \Drupal\KernelTests\Core\Recipe\RecipeRunnerTest::testConfigFromModuleAndRecipe()

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php, line 137

Class

RecipeRunnerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Recipe%21RecipeRunner.php/class/RecipeRunner/11.x" title="Applies a recipe." class="local">\Drupal\Core\Recipe\RecipeRunner</a> @group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testConfigFromModuleAndRecipe() : void {
    // Test the state prior to applying the recipe.
    $this->assertEmpty($this->container
        ->get('config.factory')
        ->listAll('config_test.'), 'There is no config_test configuration');
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/config_from_module_and_recipe');
    RecipeRunner::processRecipe($recipe);
    // Test the state after to applying the recipe.
    $this->assertNotEmpty($this->container
        ->get('config.factory')
        ->listAll('config_test.'), 'There is config_test configuration');
    $config_test_entities = \Drupal::entityTypeManager()->getStorage('config_test')
        ->loadMultiple();
    $this->assertSame([
        'dotted.default',
        'override',
        'override_unmet',
    ], array_keys($config_test_entities));
    $this->assertSame('Provided by recipe', $config_test_entities['dotted.default']->label());
    $this->assertSame('foo', $this->config('config_test.system')
        ->get('404'));
}

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