function RecipeConfiguratorTest::testIncludedRecipeLoaderException

Same name and namespace 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.

@legacy-covers ::getIncludedRecipe

Attributes

#[TestWith([ "no_recipe", ])] #[TestWith([ "does_not_exist", ])]

File

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

Class

RecipeConfiguratorTest
Tests Drupal\Core\Recipe\RecipeConfigurator.

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.