diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php index 07f9dedd8073d73f20dc8667a14d65f9f5d52dc4..a2044f12d1ace2151f0d7fed9b18197ccdde8d67 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -147,45 +147,45 @@ protected function setUp(): void { /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testGetIndividual() {} + public function testGetIndividual() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testPostIndividual() {} + public function testPostIndividual() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testPatchIndividual() {} + public function testPatchIndividual() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testDeleteIndividual() {} + public function testDeleteIndividual() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testCollection() {} + public function testCollection() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} - * - * @requires module irrelevant_for_this_test */ - public function testRelationships() {} + public function testRelationships() { + $this->markTestSkipped('Irrelevant for this test'); + } /** * {@inheritdoc} diff --git a/core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php b/core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php index a9587313c74c6be3819dab74b192d1de90d4186a..01260b2c85e7f7929602b23aea67f89ee537c01c 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/BrowserTestBaseTest.php @@ -10,6 +10,7 @@ /** * @group Test * @group FunctionalTests + * @group legacy * * @coversDefaultClass \Drupal\Tests\BrowserTestBase */ @@ -25,6 +26,7 @@ class BrowserTestBaseTest extends KernelTestBase { * @covers ::checkModuleRequirements */ public function testMethodRequiresModule() { + $this->expectDeprecation('Drupal\Tests\TestRequirementsTrait::checkModuleRequirements() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480'); require __DIR__ . '/../../../../fixtures/BrowserMissingDependentModuleMethodTest.php'; // @phpstan-ignore-next-line @@ -53,6 +55,7 @@ public function testMethodRequiresModule() { * @covers ::checkModuleRequirements */ public function testRequiresModule() { + $this->expectDeprecation('Drupal\Tests\TestRequirementsTrait::checkModuleRequirements() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480'); require __DIR__ . '/../../../../fixtures/BrowserMissingDependentModuleTest.php'; // @phpstan-ignore-next-line diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index d89d738e38d8965037eaa015e2bc84d276e31125..ce3d4318c89cd2aff228cb5e2b54d1c18d9c4e46 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -539,7 +539,7 @@ private function getExtensionsForModules(array $modules) { $list = $discovery->scan('module'); foreach ($modules as $name) { if (!isset($list[$name])) { - throw new Exception("Unavailable module: '$name'. If this module needs to be downloaded separately, annotate the test class with '@requires module $name'."); + throw new Exception("Unavailable module: '$name'. If this module needs to be downloaded for testing, include it in the 'require-dev' section of your composer.json file."); } $extensions[$name] = $list[$name]; } diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index f101af29df8ea754a93a314c8c5c771893579cad..192fee3f354759759b9828b95ab2e87ebe39b9a3 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -281,8 +281,12 @@ public function testLocalTimeZone() { * * @covers ::checkRequirements * @covers ::checkModuleRequirements + * + * @group legacy */ public function testMethodRequiresModule() { + $this->expectDeprecation('Drupal\Tests\TestRequirementsTrait::checkModuleRequirements() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480'); + require __DIR__ . '/../../fixtures/KernelMissingDependentModuleMethodTest.php'; // @phpstan-ignore-next-line @@ -309,8 +313,12 @@ public function testMethodRequiresModule() { * * @covers ::checkRequirements * @covers ::checkModuleRequirements + * + * @group legacy */ public function testRequiresModule() { + $this->expectDeprecation('Drupal\Tests\TestRequirementsTrait::checkModuleRequirements() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480'); + require __DIR__ . '/../../fixtures/KernelMissingDependentModuleTest.php'; // @phpstan-ignore-next-line diff --git a/core/tests/Drupal/Tests/TestRequirementsTrait.php b/core/tests/Drupal/Tests/TestRequirementsTrait.php index 8dae05cf3789bcba6fea8fae15b2298d4d359447..9cded2ee8755fc87f5ab8dbe27f0d827addbc990 100644 --- a/core/tests/Drupal/Tests/TestRequirementsTrait.php +++ b/core/tests/Drupal/Tests/TestRequirementsTrait.php @@ -35,8 +35,15 @@ protected static function getDrupalRoot() { * @throws \PHPUnit\Framework\SkippedTestError * Thrown when the requirements are not met, and this test should be * skipped. Callers should not catch this exception. + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is + * no replacement. + * + * @see https://www.drupal.org/node/3418480 */ protected function checkRequirements() { + @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + if (!$this->getName(FALSE) || !method_exists($this, $this->getName(FALSE))) { return; } @@ -80,8 +87,15 @@ protected function checkRequirements() { * @throws \PHPUnit\Framework\SkippedTestError * Thrown when the requirements are not met, and this test should be * skipped. Callers should not catch this exception. + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is + * no replacement. + * + * @see https://www.drupal.org/node/3418480 */ private function checkModuleRequirements($root, array $annotations) { + @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + // Make a list of required modules. $required_modules = []; foreach ($annotations as $requirement) { diff --git a/core/tests/fixtures/BrowserMissingDependentModuleMethodTest.php b/core/tests/fixtures/BrowserMissingDependentModuleMethodTest.php index bbf56501e83268c6984cc22725435e699fd4b96d..09a637d74c3311259b1c83cea5565f35c16fb45e 100644 --- a/core/tests/fixtures/BrowserMissingDependentModuleMethodTest.php +++ b/core/tests/fixtures/BrowserMissingDependentModuleMethodTest.php @@ -4,6 +4,8 @@ use Drupal\Tests\BrowserTestBase; +@trigger_error('\\Drupal\\FunctionalTests\\BrowserMissingDependentModuleMethodTest is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + /** * A fixture test class with requires annotation. * @@ -13,6 +15,11 @@ * This test class should not be discovered by run-tests.sh, phpstan or phpunit. * * @group fixture + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no + * replacement. + * + * @see https://www.drupal.org/node/3418480 */ class BrowserMissingDependentModuleMethodTest extends BrowserTestBase { diff --git a/core/tests/fixtures/BrowserMissingDependentModuleTest.php b/core/tests/fixtures/BrowserMissingDependentModuleTest.php index 3a443746b1764761e6901970666305516735c505..40d8b370f643beaa178a0169b12b2fb1c303f01a 100644 --- a/core/tests/fixtures/BrowserMissingDependentModuleTest.php +++ b/core/tests/fixtures/BrowserMissingDependentModuleTest.php @@ -4,6 +4,8 @@ use Drupal\Tests\BrowserTestBase; +@trigger_error('\\Drupal\\FunctionalTests\\BrowserMissingDependentModuleTest is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + /** * A fixture test class with requires annotation. * @@ -14,6 +16,11 @@ * * @requires module module_does_not_exist * @group fixture + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no + * replacement. + * + * @see https://www.drupal.org/node/3418480 */ class BrowserMissingDependentModuleTest extends BrowserTestBase { diff --git a/core/tests/fixtures/KernelMissingDependentModuleMethodTest.php b/core/tests/fixtures/KernelMissingDependentModuleMethodTest.php index 80f69c32a9eea612648f58bfc769b9a28841f1c4..55d4a4e472345370d933ba4abac00270c881470c 100644 --- a/core/tests/fixtures/KernelMissingDependentModuleMethodTest.php +++ b/core/tests/fixtures/KernelMissingDependentModuleMethodTest.php @@ -2,6 +2,8 @@ namespace Drupal\KernelTests; +@trigger_error('\\Drupal\\FunctionalTests\\KernelMissingDependentModuleMethodTest is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + /** * A fixture test class with requires annotation. * @@ -11,6 +13,11 @@ * This test class should not be discovered by run-tests.sh, phpstan or phpunit. * * @group fixture + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no + * replacement. + * + * @see https://www.drupal.org/node/3418480 */ class KernelMissingDependentModuleMethodTest extends KernelTestBase { diff --git a/core/tests/fixtures/KernelMissingDependentModuleTest.php b/core/tests/fixtures/KernelMissingDependentModuleTest.php index 9fc372c03b58fd20e34bf2affd651c438b49d6d6..7abc5e733f784f60f1694bac8df0229a9b2ae341 100644 --- a/core/tests/fixtures/KernelMissingDependentModuleTest.php +++ b/core/tests/fixtures/KernelMissingDependentModuleTest.php @@ -2,6 +2,8 @@ namespace Drupal\KernelTests; +@trigger_error('\\Drupal\\FunctionalTests\\KernelMissingDependentModuleTest is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3418480', E_USER_DEPRECATED); + /** * A fixture test class with requires annotation. * @@ -12,6 +14,11 @@ * * @requires module module_does_not_exist * @group fixture + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no + * replacement. + * + * @see https://www.drupal.org/node/3418480 */ class KernelMissingDependentModuleTest extends KernelTestBase {