Loading core/core.api.php +5 −7 Original line number Diff line number Diff line Loading @@ -1150,15 +1150,13 @@ * subdirectory) * * Some notes about writing PHP test classes: * - The class needs a phpDoc comment block with a description and * @group annotation, which gives information about the test. * - For unit tests, this comment block should also have @coversDefaultClass * annotation. * - The class needs a phpDoc comment block with a description of the test, and * a #[Group(...)] attribute, which gives information about the test. * - For unit tests, this comment block should also have a #[CoversClass(...)] * attribute. * - When writing tests, put the test code into public methods, each covering a * logical subset of the functionality that is being tested. * - The test methods must have names starting with 'test'. For unit tests, the * test methods need to have a phpDoc block with @covers annotation telling * which class method they are testing. * - The test methods must have names starting with 'test'. * - In some cases, you may need to write a test module to support your test; * put such modules under the your_module/tests/modules directory. * Loading core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Database\Database; use Drupal\jsonapi\ResourceType\ResourceType; use Drupal\jsonapi\ResourceType\ResourceTypeRepository; use Drupal\node\Entity\NodeType; use Drupal\Tests\jsonapi\Kernel\JsonapiKernelTestBase; use PHPUnit\Framework\Attributes\CoversClass; Loading @@ -16,11 +17,10 @@ /** * Tests Drupal\jsonapi\ResourceType\ResourceType. * * @coversClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository * * @internal */ #[CoversClass(ResourceType::class)] #[CoversClass(ResourceTypeRepository::class)] #[Group('jsonapi')] #[RunTestsInSeparateProcesses] class RelatedResourceTypesTest extends JsonapiKernelTestBase { Loading core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php +3 −2 Original line number Diff line number Diff line Loading @@ -7,22 +7,23 @@ use Drupal\Core\Render\Markup; use Drupal\jsonapi\JsonApiResource\ResourceObject; use Drupal\jsonapi\Normalizer\Value\CacheableNormalization; use Drupal\jsonapi\Serializer\Serializer; use Drupal\jsonapi_test_data_type\TraversableObject; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\Tests\jsonapi\Kernel\JsonapiKernelTestBase; use Drupal\user\Entity\User; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; /** * Tests the JSON:API serializer. * * @coversClass \Drupal\jsonapi\Serializer\Serializer * * @internal */ #[Group('jsonapi')] #[CoversClass(Serializer::class)] #[RunTestsInSeparateProcesses] class SerializerTest extends JsonapiKernelTestBase { Loading core/modules/media/tests/src/FunctionalJavascript/MediaEmbedFilterTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ abstract class MediaEmbedFilterTestBase extends MediaJavascriptTestBase { */ public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); // Necessary for @covers to work. // Necessary for code coverage to work. require_once __DIR__ . '/../../../media.module'; } Loading core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php +1 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,7 @@ use org\bovigo\vfs\vfsStream; /** * @coversDefaultClass \Drupal\Core\Hook\HookCollectorPass * @group Hook * Setup group includes trait. */ trait GroupIncludesTestTrait { Loading Loading
core/core.api.php +5 −7 Original line number Diff line number Diff line Loading @@ -1150,15 +1150,13 @@ * subdirectory) * * Some notes about writing PHP test classes: * - The class needs a phpDoc comment block with a description and * @group annotation, which gives information about the test. * - For unit tests, this comment block should also have @coversDefaultClass * annotation. * - The class needs a phpDoc comment block with a description of the test, and * a #[Group(...)] attribute, which gives information about the test. * - For unit tests, this comment block should also have a #[CoversClass(...)] * attribute. * - When writing tests, put the test code into public methods, each covering a * logical subset of the functionality that is being tested. * - The test methods must have names starting with 'test'. For unit tests, the * test methods need to have a phpDoc block with @covers annotation telling * which class method they are testing. * - The test methods must have names starting with 'test'. * - In some cases, you may need to write a test module to support your test; * put such modules under the your_module/tests/modules directory. * Loading
core/modules/jsonapi/tests/src/Kernel/ResourceType/RelatedResourceTypesTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Database\Database; use Drupal\jsonapi\ResourceType\ResourceType; use Drupal\jsonapi\ResourceType\ResourceTypeRepository; use Drupal\node\Entity\NodeType; use Drupal\Tests\jsonapi\Kernel\JsonapiKernelTestBase; use PHPUnit\Framework\Attributes\CoversClass; Loading @@ -16,11 +17,10 @@ /** * Tests Drupal\jsonapi\ResourceType\ResourceType. * * @coversClass \Drupal\jsonapi\ResourceType\ResourceTypeRepository * * @internal */ #[CoversClass(ResourceType::class)] #[CoversClass(ResourceTypeRepository::class)] #[Group('jsonapi')] #[RunTestsInSeparateProcesses] class RelatedResourceTypesTest extends JsonapiKernelTestBase { Loading
core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php +3 −2 Original line number Diff line number Diff line Loading @@ -7,22 +7,23 @@ use Drupal\Core\Render\Markup; use Drupal\jsonapi\JsonApiResource\ResourceObject; use Drupal\jsonapi\Normalizer\Value\CacheableNormalization; use Drupal\jsonapi\Serializer\Serializer; use Drupal\jsonapi_test_data_type\TraversableObject; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; use Drupal\Tests\jsonapi\Kernel\JsonapiKernelTestBase; use Drupal\user\Entity\User; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; /** * Tests the JSON:API serializer. * * @coversClass \Drupal\jsonapi\Serializer\Serializer * * @internal */ #[Group('jsonapi')] #[CoversClass(Serializer::class)] #[RunTestsInSeparateProcesses] class SerializerTest extends JsonapiKernelTestBase { Loading
core/modules/media/tests/src/FunctionalJavascript/MediaEmbedFilterTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ abstract class MediaEmbedFilterTestBase extends MediaJavascriptTestBase { */ public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); // Necessary for @covers to work. // Necessary for code coverage to work. require_once __DIR__ . '/../../../media.module'; } Loading
core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php +1 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,7 @@ use org\bovigo\vfs\vfsStream; /** * @coversDefaultClass \Drupal\Core\Hook\HookCollectorPass * @group Hook * Setup group includes trait. */ trait GroupIncludesTestTrait { Loading