function RecipeRunnerTest::testModuleInstall

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

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testModuleInstall() : void {
    // Test the state prior to applying the recipe.
    $this->assertFalse($this->container
        ->get('module_handler')
        ->moduleExists('filter'), 'The filter module is not installed');
    $this->assertFalse($this->container
        ->get('module_handler')
        ->moduleExists('text'), 'The text module is not installed');
    $this->assertFalse($this->container
        ->get('module_handler')
        ->moduleExists('node'), 'The node module is not installed');
    $this->assertFalse($this->container
        ->get('config.storage')
        ->exists('node.settings'), 'The node.settings configuration does not exist');
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/install_two_modules');
    RecipeRunner::processRecipe($recipe);
    // Test the state after applying the recipe.
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('filter'), 'The filter module is installed');
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('text'), 'The text module is installed');
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('node'), 'The node module is installed');
    $this->assertTrue($this->container
        ->get('config.storage')
        ->exists('node.settings'), 'The node.settings configuration has been created');
    $this->assertFalse($this->config('node.settings')
        ->get('use_admin_theme'), 'The node.settings:use_admin_theme is set to FALSE');
}

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