function RecipeRunnerTest::testConfigFromModuleAndRecipe

Same name and namespace in other branches
  1. 11.x 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 \Drupal\Core\Recipe\RecipeRunner[[api-linebreak]] @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.