From 408df6b72f812248ad6f55a6960781d5072ffde5 Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Sun, 11 Aug 2024 16:04:01 +0900 Subject: [PATCH] Revert "Issue #3462383 by phenaproxima, catch, alexpott, longwave: CoreRecipesTest is slow" This reverts commit e47f22dfd07518ba571affc4055cf0de44fe77ac. --- core/lib/Drupal/Core/Test/TestDiscovery.php | 9 --- .../Recipe/GenericRecipeTestBase.php | 55 ------------------- core/phpunit.xml.dist | 3 - .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../tests/src/Functional/GenericTest.php | 12 ---- .../Core/Recipe/CoreRecipesTest.php | 39 +++++++++---- 32 files changed, 27 insertions(+), 415 deletions(-) delete mode 100644 core/modules/system/tests/src/Functional/Recipe/GenericRecipeTestBase.php delete mode 100644 core/recipes/administrator_role/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/article_comment/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/article_content_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/article_tags/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/audio_media_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/basic_block_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/basic_html_format_editor/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/basic_shortcuts/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/comment_base/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/content_editor_role/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/content_search/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/core_recommended_admin_theme/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/core_recommended_front_end_theme/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/core_recommended_maintenance/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/core_recommended_performance/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/document_media_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/editorial_workflow/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/feedback_contact_form/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/full_html_format_editor/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/image_media_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/local_video_media_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/page_content_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/remote_video_media_type/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/restricted_html_format/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/standard/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/standard_responsive_images/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/tags_taxonomy/tests/src/Functional/GenericTest.php delete mode 100644 core/recipes/user_picture/tests/src/Functional/GenericTest.php rename core/tests/Drupal/{Tests => FunctionalTests}/Core/Recipe/CoreRecipesTest.php (51%) diff --git a/core/lib/Drupal/Core/Test/TestDiscovery.php b/core/lib/Drupal/Core/Test/TestDiscovery.php index 6a4e8facfd5f..a90587c52dd3 100644 --- a/core/lib/Drupal/Core/Test/TestDiscovery.php +++ b/core/lib/Drupal/Core/Test/TestDiscovery.php @@ -106,15 +106,6 @@ public function registerTestNamespaces() { $this->testNamespaces["Drupal\\Tests\\$name\\"][] = "$base_path/tests/src"; } - // Expose tests provided by core recipes. - $base_path = $this->root . '/core/recipes'; - if (@opendir($base_path)) { - while (($recipe = readdir()) !== FALSE) { - $this->testNamespaces["Drupal\\Tests\\Recipe\\Core\\$recipe\\"][] = "$base_path/$recipe/tests/src"; - } - closedir(); - } - foreach ($this->testNamespaces as $prefix => $paths) { $this->classLoader->addPsr4($prefix, $paths); } diff --git a/core/modules/system/tests/src/Functional/Recipe/GenericRecipeTestBase.php b/core/modules/system/tests/src/Functional/Recipe/GenericRecipeTestBase.php deleted file mode 100644 index 4fbbe80c70fb..000000000000 --- a/core/modules/system/tests/src/Functional/Recipe/GenericRecipeTestBase.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\system\Functional\Recipe; - -use Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait; -use Drupal\Tests\BrowserTestBase; - -/** - * Runs a series of generic tests for one recipe. - */ -abstract class GenericRecipeTestBase extends BrowserTestBase { - - use RecipeTestTrait; - - /** - * {@inheritdoc} - */ - protected $profile = 'minimal'; - - /** - * {@inheritdoc} - */ - protected $defaultTheme = 'stark'; - - /** - * Returns the path of the recipe under test. - * - * @return string - * The absolute path of the recipe that contains this test. - */ - protected function getRecipePath(): string { - // Assume this test in located in RECIPE_DIR/tests/src/Functional. - return dirname((new \ReflectionObject($this))->getFileName(), 4); - } - - /** - * Applies the recipe under test. - */ - protected function doApply(): void { - $this->applyRecipe($this->getRecipePath()); - } - - /** - * Tests that this recipe can be applied multiple times. - */ - public function testRecipeCanBeApplied(): void { - $this->setUpCurrentUser(admin: TRUE); - $this->doApply(); - // Apply the recipe again to prove that it is idempotent. - $this->doApply(); - } - -} diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist index 851579d320c2..36168ff4623f 100644 --- a/core/phpunit.xml.dist +++ b/core/phpunit.xml.dist @@ -88,7 +88,6 @@ <testsuite name="kernel"> <directory>tests/Drupal/KernelTests</directory> <directory>modules/**/tests/src/Kernel</directory> - <directory>recipes/*/tests/src/Kernel</directory> <directory>profiles/**/tests/src/Kernel</directory> <directory>themes/**/tests/src/Kernel</directory> <directory>../modules/**/tests/src/Kernel</directory> @@ -99,7 +98,6 @@ <directory>tests/Drupal/FunctionalTests</directory> <directory>modules/**/tests/src/Functional</directory> <directory>profiles/**/tests/src/Functional</directory> - <directory>recipes/*/tests/src/Functional</directory> <directory>themes/**/tests/src/Functional</directory> <directory>../modules/**/tests/src/Functional</directory> <directory>../profiles/**/tests/src/Functional</directory> @@ -108,7 +106,6 @@ <testsuite name="functional-javascript"> <directory>tests/Drupal/FunctionalJavascriptTests</directory> <directory>modules/**/tests/src/FunctionalJavascript</directory> - <directory>recipes/*/tests/src/FunctionalJavascript</directory> <directory>profiles/**/tests/src/FunctionalJavascript</directory> <directory>themes/**/tests/src/FunctionalJavascript</directory> <directory>../modules/**/tests/src/FunctionalJavascript</directory> diff --git a/core/recipes/administrator_role/tests/src/Functional/GenericTest.php b/core/recipes/administrator_role/tests/src/Functional/GenericTest.php deleted file mode 100644 index a88b9e258d44..000000000000 --- a/core/recipes/administrator_role/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\administrator_role\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_administrator_role_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/article_comment/tests/src/Functional/GenericTest.php b/core/recipes/article_comment/tests/src/Functional/GenericTest.php deleted file mode 100644 index 34fa7beaf59f..000000000000 --- a/core/recipes/article_comment/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\article_comment\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_article_comment_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/article_content_type/tests/src/Functional/GenericTest.php b/core/recipes/article_content_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index f054de858227..000000000000 --- a/core/recipes/article_content_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\article_content_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_article_content_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/article_tags/tests/src/Functional/GenericTest.php b/core/recipes/article_tags/tests/src/Functional/GenericTest.php deleted file mode 100644 index 80e7a2229d1c..000000000000 --- a/core/recipes/article_tags/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\article_tags\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_article_tags_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/audio_media_type/tests/src/Functional/GenericTest.php b/core/recipes/audio_media_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index eadb51ea245e..000000000000 --- a/core/recipes/audio_media_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\audio_media_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_audio_media_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/basic_block_type/tests/src/Functional/GenericTest.php b/core/recipes/basic_block_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index 2d1038a6a63c..000000000000 --- a/core/recipes/basic_block_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\basic_block_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_basic_block_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/basic_html_format_editor/tests/src/Functional/GenericTest.php b/core/recipes/basic_html_format_editor/tests/src/Functional/GenericTest.php deleted file mode 100644 index c6d68820031f..000000000000 --- a/core/recipes/basic_html_format_editor/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\basic_html_format_editor\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_basic_html_format_editor_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/basic_shortcuts/tests/src/Functional/GenericTest.php b/core/recipes/basic_shortcuts/tests/src/Functional/GenericTest.php deleted file mode 100644 index 64e0e1d5334c..000000000000 --- a/core/recipes/basic_shortcuts/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\basic_shortcuts\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_basic_shortcuts_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/comment_base/tests/src/Functional/GenericTest.php b/core/recipes/comment_base/tests/src/Functional/GenericTest.php deleted file mode 100644 index b3c5bc32ff65..000000000000 --- a/core/recipes/comment_base/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\comment_base\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_comment_base_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/content_editor_role/tests/src/Functional/GenericTest.php b/core/recipes/content_editor_role/tests/src/Functional/GenericTest.php deleted file mode 100644 index e2c20aa6b1ca..000000000000 --- a/core/recipes/content_editor_role/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\content_editor_role\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_content_editor_role_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/content_search/tests/src/Functional/GenericTest.php b/core/recipes/content_search/tests/src/Functional/GenericTest.php deleted file mode 100644 index f78077cfffb6..000000000000 --- a/core/recipes/content_search/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\content_search\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_content_search_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/core_recommended_admin_theme/tests/src/Functional/GenericTest.php b/core/recipes/core_recommended_admin_theme/tests/src/Functional/GenericTest.php deleted file mode 100644 index b48e1b0c79fa..000000000000 --- a/core/recipes/core_recommended_admin_theme/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\core_recommended_admin_theme\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_recommended_admin_theme_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/core_recommended_front_end_theme/tests/src/Functional/GenericTest.php b/core/recipes/core_recommended_front_end_theme/tests/src/Functional/GenericTest.php deleted file mode 100644 index 6aa4007d39b4..000000000000 --- a/core/recipes/core_recommended_front_end_theme/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\core_recommended_front_end_theme\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_recommended_front_end_theme_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/core_recommended_maintenance/tests/src/Functional/GenericTest.php b/core/recipes/core_recommended_maintenance/tests/src/Functional/GenericTest.php deleted file mode 100644 index 4dcb675e6e88..000000000000 --- a/core/recipes/core_recommended_maintenance/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\core_recommended_maintenance\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_recommended_maintenance_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/core_recommended_performance/tests/src/Functional/GenericTest.php b/core/recipes/core_recommended_performance/tests/src/Functional/GenericTest.php deleted file mode 100644 index 416426ddeefd..000000000000 --- a/core/recipes/core_recommended_performance/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\core_recommended_performance\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_recommended_performance_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/document_media_type/tests/src/Functional/GenericTest.php b/core/recipes/document_media_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index d7c336a129a5..000000000000 --- a/core/recipes/document_media_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\document_media_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_document_media_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/editorial_workflow/tests/src/Functional/GenericTest.php b/core/recipes/editorial_workflow/tests/src/Functional/GenericTest.php deleted file mode 100644 index 9e02c77db6ff..000000000000 --- a/core/recipes/editorial_workflow/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\editorial_workflow\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_editorial_workflow_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/feedback_contact_form/tests/src/Functional/GenericTest.php b/core/recipes/feedback_contact_form/tests/src/Functional/GenericTest.php deleted file mode 100644 index e9fec12aff76..000000000000 --- a/core/recipes/feedback_contact_form/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\feedback_contact_form\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_feedback_contact_form_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/full_html_format_editor/tests/src/Functional/GenericTest.php b/core/recipes/full_html_format_editor/tests/src/Functional/GenericTest.php deleted file mode 100644 index 7ab5063335a1..000000000000 --- a/core/recipes/full_html_format_editor/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\full_html_format_editor\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_full_html_format_editor_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/image_media_type/tests/src/Functional/GenericTest.php b/core/recipes/image_media_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index b3da56dd2986..000000000000 --- a/core/recipes/image_media_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\image_media_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_image_media_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/local_video_media_type/tests/src/Functional/GenericTest.php b/core/recipes/local_video_media_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index 04946b7e71cd..000000000000 --- a/core/recipes/local_video_media_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\local_video_media_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_local_video_media_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/page_content_type/tests/src/Functional/GenericTest.php b/core/recipes/page_content_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index 154c58eae0bb..000000000000 --- a/core/recipes/page_content_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\page_content_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_page_content_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/remote_video_media_type/tests/src/Functional/GenericTest.php b/core/recipes/remote_video_media_type/tests/src/Functional/GenericTest.php deleted file mode 100644 index 13a2391d1644..000000000000 --- a/core/recipes/remote_video_media_type/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\remote_video_media_type\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_remote_video_media_type_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/restricted_html_format/tests/src/Functional/GenericTest.php b/core/recipes/restricted_html_format/tests/src/Functional/GenericTest.php deleted file mode 100644 index 5c5f55fe781a..000000000000 --- a/core/recipes/restricted_html_format/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\restricted_html_format\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_restricted_html_format_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/standard/tests/src/Functional/GenericTest.php b/core/recipes/standard/tests/src/Functional/GenericTest.php deleted file mode 100644 index e496531c5c6d..000000000000 --- a/core/recipes/standard/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\standard\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_standard_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/standard_responsive_images/tests/src/Functional/GenericTest.php b/core/recipes/standard_responsive_images/tests/src/Functional/GenericTest.php deleted file mode 100644 index 73d802261f97..000000000000 --- a/core/recipes/standard_responsive_images/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\standard_responsive_images\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_standard_responsive_images_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/tags_taxonomy/tests/src/Functional/GenericTest.php b/core/recipes/tags_taxonomy/tests/src/Functional/GenericTest.php deleted file mode 100644 index 754bb283ddde..000000000000 --- a/core/recipes/tags_taxonomy/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\tags_taxonomy\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_tags_taxonomy_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/recipes/user_picture/tests/src/Functional/GenericTest.php b/core/recipes/user_picture/tests/src/Functional/GenericTest.php deleted file mode 100644 index 384cd870f1b1..000000000000 --- a/core/recipes/user_picture/tests/src/Functional/GenericTest.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -namespace Drupal\Tests\Recipe\Core\user_picture\Functional; - -use Drupal\Tests\system\Functional\Recipe\GenericRecipeTestBase; - -/** - * @group core_user_picture_recipe - */ -class GenericTest extends GenericRecipeTestBase {} diff --git a/core/tests/Drupal/Tests/Core/Recipe/CoreRecipesTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php similarity index 51% rename from core/tests/Drupal/Tests/Core/Recipe/CoreRecipesTest.php rename to core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php index c60fc97a1d1b..0d4c7f2669fc 100644 --- a/core/tests/Drupal/Tests/Core/Recipe/CoreRecipesTest.php +++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/CoreRecipesTest.php @@ -2,28 +2,41 @@ declare(strict_types=1); -namespace Drupal\Tests\Core\Recipe; +namespace Drupal\FunctionalTests\Core\Recipe; -use Drupal\Tests\UnitTestCase; +use Drupal\Tests\BrowserTestBase; use Symfony\Component\Finder\Finder; /** - * Tests that all core recipes have a generic test. + * Tests applying all core-provided recipes on top of the Empty profile. * * @group Recipe + * @group #slow */ -class CoreRecipesTest extends UnitTestCase { +class CoreRecipesTest extends BrowserTestBase { + + use RecipeTestTrait; + + /** + * {@inheritdoc} + */ + protected $profile = 'minimal'; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; /** - * Data provider for ::testRecipeHasGenericTest(). + * The data provider for apply recipe test. * * @return iterable<array<string>> * An iterable containing paths to recipe files. */ - public static function providerRecipeHasGenericTest(): iterable { + public static function providerApplyRecipe(): iterable { $finder = Finder::create() ->in([ - dirname(__DIR__, 5) . '/recipes', + static::getDrupalRoot() . '/core/recipes', ]) ->directories() // Recipes can't contain other recipes, so we don't need to search in @@ -31,7 +44,6 @@ public static function providerRecipeHasGenericTest(): iterable { ->depth(0) // The Example recipe is for documentation only, and cannot be applied. ->notName(['example']); - static::assertGreaterThan(0, count($finder), 'No core recipes were found.'); $scenarios = []; /** @var \Symfony\Component\Finder\SplFileInfo $recipe */ @@ -45,15 +57,18 @@ public static function providerRecipeHasGenericTest(): iterable { } /** - * Test that a recipe has a generic test. + * Test the recipe apply. * * @param string $path * The path to the recipe file. * - * @dataProvider providerRecipeHasGenericTest + * @dataProvider providerApplyRecipe */ - public function testRecipeHasGenericTest(string $path): void { - $this->assertFileExists($path . '/tests/src/Functional/GenericTest.php'); + 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); } } -- GitLab