
| Current Path : /var/www/html/rocksensor1/web/core/tests/Drupal/FunctionalTests/Core/Recipe/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php |
<?php
declare(strict_types=1);
namespace Drupal\FunctionalTests\Core\Recipe;
use Drupal\Tests\BrowserTestBase;
use Symfony\Component\Finder\Finder;
/**
* Tests applying all core-provided recipes on top of the Empty profile.
*
* @group Recipe
* @group #slow
*/
class CoreRecipesTest extends BrowserTestBase {
use RecipeTestTrait;
/**
* {@inheritdoc}
*/
protected $profile = 'minimal';
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The data provider for apply recipe test.
*
* @return iterable<array<string>>
* An iterable containing paths to recipe files.
*/
public static function providerApplyRecipe(): iterable {
$finder = Finder::create()
->in([
static::getDrupalRoot() . '/core/recipes',
])
->directories()
// Recipes can't contain other recipes, so we don't need to search in
// subdirectories.
->depth(0)
// The Example recipe is for documentation only, and cannot be applied.
->notName(['example']);
$scenarios = [];
/** @var \Symfony\Component\Finder\SplFileInfo $recipe */
foreach ($finder as $recipe) {
$name = $recipe->getBasename();
$scenarios[$name] = [
$recipe->getPathname(),
];
}
return $scenarios;
}
/**
* Test the recipe apply.
*
* @param string $path
* The path to the recipe file.
*
* @dataProvider providerApplyRecipe
*/
public function testApplyRecipe(string $path): void {
$this->setUpCurrentUser(admin: TRUE);
$this->applyRecipe($path);
// Apply the recipe again to prove that it is idempotent.
$this->applyRecipe($path);
}
}