function RecipeRunnerTest::testModuleAndThemeInstall

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

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testModuleAndThemeInstall() : void {
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/base_theme_and_views');
    RecipeRunner::processRecipe($recipe);
    // Test the state after applying the recipe.
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('views'), 'The views module is installed');
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('node'), 'The node module is installed');
    $this->assertTrue($this->container
        ->get('theme_handler')
        ->themeExists('test_basetheme'), 'The test_basetheme theme is installed');
    $this->assertTrue($this->container
        ->get('theme_handler')
        ->themeExists('test_subtheme'), 'The test_subtheme theme is installed');
    $this->assertTrue($this->container
        ->get('theme_handler')
        ->themeExists('test_subsubtheme'), 'The test_subsubtheme theme is installed');
    $this->assertTrue($this->container
        ->get('config.storage')
        ->exists('node.settings'), 'The node.settings configuration has been created');
    $this->assertFalse($this->container
        ->get('config.storage')
        ->exists('views.view.archive'), 'The views.view.archive configuration has not been created');
    $this->assertEmpty(View::loadMultiple(), "No views exist");
}

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