function RecipeRunnerTest::testRecipesAreDisambiguatedByPath

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

File

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

Class

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

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testRecipesAreDisambiguatedByPath() : void {
    $recipe_data = <<<YAML
name: 'Recipe include'
recipes:
  - core/tests/fixtures/recipes/recipe_include
install:
  - config_test
YAML;
    $recipe = $this->createRecipe($recipe_data, '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->assertTrue($this->container
        ->get('module_handler')
        ->moduleExists('config_test'), 'Config test module installed');
    $this->assertSame('Test content type', NodeType::load('test')?->label());
    $this->assertSame('Another test content type', NodeType::load('another_test')?->label());
    $operations = RecipeRunner::toBatchOperations($recipe);
    $this->assertSame('triggerEvent', $operations[7][0][1]);
    $this->assertSame('Install node with config', $operations[7][1][0]->name);
    $this->assertStringEndsWith('core/tests/fixtures/recipes/install_node_with_config', $operations[7][1][0]->path);
    $this->assertSame('triggerEvent', $operations[10][0][1]);
    $this->assertSame('Recipe include', $operations[10][1][0]->name);
    $this->assertStringEndsWith('core/tests/fixtures/recipes/recipe_include', $operations[10][1][0]->path);
    $this->assertSame('triggerEvent', $operations[12][0][1]);
    $this->assertSame('Recipe include', $operations[12][1][0]->name);
    $this->assertSame($this->siteDirectory . '/recipes/recipe_include', $operations[12][1][0]->path);
}

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