function RecipeConfiguratorTest::testRecipeConfigurator
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Recipe/RecipeConfiguratorTest.php \Drupal\KernelTests\Core\Recipe\RecipeConfiguratorTest::testRecipeConfigurator()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ RecipeConfiguratorTest.php, line 18
Class
- RecipeConfiguratorTest
- @coversDefaultClass \Drupal\Core\Recipe\RecipeConfigurator @group Recipe
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testRecipeConfigurator() : void {
$recipe_configurator = new RecipeConfigurator([
'install_two_modules',
'install_node_with_config',
'recipe_include',
], 'core/tests/fixtures/recipes');
// Private method "listAllRecipes".
$reflection = new \ReflectionMethod('\\Drupal\\Core\\Recipe\\RecipeConfigurator', 'listAllRecipes');
// Test methods.
/** @var \Drupal\Core\Recipe\Recipe[] $recipes */
$recipes = (array) $reflection->invoke($recipe_configurator);
$recipes_names = array_map(fn(Recipe $recipe) => $recipe->name, $recipes);
$recipe_extensions = $recipe_configurator->listAllExtensions();
$expected_recipes_names = [
'Install two modules',
'Install node with config',
'Recipe include',
];
$expected_recipe_extensions = [
'system',
'user',
'filter',
'field',
'text',
'node',
'dblog',
];
$this->assertEquals($expected_recipes_names, $recipes_names);
$this->assertEquals($expected_recipe_extensions, $recipe_extensions);
$this->assertEquals(1, array_count_values($recipes_names)['Install node with config']);
$this->assertEquals(1, array_count_values($recipe_extensions)['field']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.