function RecipeDiscoveryTest::testRecipeDiscoveryException
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Recipe/RecipeDiscoveryTest.php \Drupal\KernelTests\Core\Recipe\RecipeDiscoveryTest::testRecipeDiscoveryException()
Tests the exception thrown when recipe discovery cannot find a recipe.
@testWith ["no_recipe"] ["does_not_exist"]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ RecipeDiscoveryTest.php, line 35
Class
- RecipeDiscoveryTest
- @coversDefaultClass \Drupal\Core\Recipe\RecipeDiscovery @group Recipe
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testRecipeDiscoveryException(string $recipe) : void {
$discovery = new RecipeDiscovery('core/tests/fixtures/recipes');
try {
$discovery->getRecipe($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.