function RecipeRunnerTest::testRecipeInclude

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

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testRecipeInclude() : void {
    // Test the state prior to applying the recipe.
    $this->assertEmpty($this->container
        ->get('config.factory')
        ->listAll('node.'), 'There is no node configuration');
    $this->assertFalse($this->container
        ->get('module_handler')
        ->moduleExists('dblog'), 'Dblog module not installed');
    $recipe = Recipe::createFromDirectory('core/tests/fixtures/recipes/recipe_include');
    RecipeRunner::processRecipe($recipe);
    // Test the state after to applying the recipe.
    $this->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('dblog'), 'Dblog module installed');
    $this->assertSame('Test content type', NodeType::load('test')?->label());
    $this->assertSame('Another test content type', NodeType::load('another_test')?->label());
}

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