function RecipeConfiguratorTest::testIncludedRecipeLoaderException

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

Tests exception thrown when RecipeConfigurator cannot find a recipe.

@testWith ["no_recipe"] ["does_not_exist"]

@covers ::getIncludedRecipe

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeConfiguratorTest.php, line 73

Class

RecipeConfiguratorTest
@coversDefaultClass \Drupal\Core\Recipe\RecipeConfigurator @group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testIncludedRecipeLoaderException(string $recipe) : void {
    try {
        RecipeConfigurator::getIncludedRecipe('core/tests/fixtures/recipes', $recipe);
        $this->fail('Expected exception not thrown');
    } catch (UnknownRecipeException $e) {
        $this->assertSame($recipe, $e->recipe);
        $this->assertSame('core/tests/fixtures/recipes', $e->searchPath);
        $this->assertSame('Can not find the ' . $recipe . ' recipe, search path: ' . $e->searchPath, $e->getMessage());
    }
}

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