function RecipeTest::testPreExistingDifferentConfiguration

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

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeTest.php, line 44

Class

RecipeTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Recipe%21Recipe.php/class/Recipe/11.x" title="@internal This API is experimental." class="local">\Drupal\Core\Recipe\Recipe</a> @group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testPreExistingDifferentConfiguration() : void {
    // Install the node module, its dependencies and configuration.
    $this->container
        ->get('module_installer')
        ->install([
        'node',
    ]);
    $this->assertFalse($this->config('node.settings')
        ->get('use_admin_theme'), 'The node.settings:use_admin_theme is set to FALSE');
    try {
        Recipe::createFromDirectory('core/tests/fixtures/recipes/install_node_with_config');
        $this->fail('Expected exception not thrown');
    } catch (RecipePreExistingConfigException $e) {
        $this->assertSame("The configuration 'node.settings' exists already and does not match the recipe's configuration", $e->getMessage());
        $this->assertSame('node.settings', $e->configName);
    }
}

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