function RecipeRunnerTest::testModuleConfigurationOverride

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

File

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

Class

RecipeRunnerTest
@coversDefaultClass \Drupal\Core\Recipe\RecipeRunner @group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testModuleConfigurationOverride() : void {
    // Test the state prior to applying the recipe.
    $this->assertEmpty($this->container
        ->get('config.factory')
        ->listAll('node.'), 'There is no node configuration');
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/install_node_with_config');
    RecipeRunner::processRecipe($recipe);
    // Test the state after applying the recipe.
    $this->assertTrue($this->container
        ->get('config.storage')
        ->exists('node.settings'), 'The node.settings configuration has been created');
    $this->assertTrue($this->container
        ->get('config.storage')
        ->exists('node.settings'), 'The node.settings configuration has been created');
    $this->assertTrue($this->config('node.settings')
        ->get('use_admin_theme'), 'The node.settings:use_admin_theme is set to TRUE');
    $this->assertSame('Test content type', NodeType::load('test')?->label());
    $node_type_data = $this->config('node.type.test')
        ->get();
    $this->assertGreaterThan(0, strlen($node_type_data['uuid']), 'The node type configuration has been assigned a UUID.');
    // cSpell:disable-next-line
    $this->assertSame('8Jlq8CmNXHVtNIHBHgFGpnAKthlUz0XoW_D0g56QXqY', $node_type_data['_core']['default_config_hash']);
}

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