diff --git a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php index 0ae2104b6ed75ef09ed489bf4decd9e2380b3251..69eca6473b49a78daa6f658397eb318352ef991b 100644 --- a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php +++ b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php @@ -42,6 +42,9 @@ public function testNonHtmlResponse($response_class): void { $big_pipe_response_attachments_processor->processAttachments($non_html_response); } + /** + * Provides data to testNonHtmlResponse(). + */ public static function nonHtmlResponseProvider() { return [ 'AjaxResponse, which implements AttachmentsInterface' => [AjaxResponse::class], @@ -89,6 +92,9 @@ public function testHtmlResponse(array $attachments): void { $this->assertEquals('processed', $processed_big_pipe_response->getContent(), 'Content of returned (processed) response object MUST be changed.'); } + /** + * Provides data to testHtmlResponse(). + */ public static function attachmentsProvider() { $typical_cases = [ 'no attachments' => [[]], diff --git a/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php b/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php index 3a6090b7afffae2ded5ca4366d273c4a24e8edea..ec0cd6c9a3c537f2f87584ba58b07468e06019e4 100644 --- a/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php +++ b/core/modules/big_pipe/tests/src/Unit/StackMiddleware/ContentLengthTest.php @@ -37,6 +37,9 @@ public function testHandle(false|int $expected_header, Response $response): void $this->assertSame((string) $expected_header, $response->headers->get('Content-Length')); } + /** + * Provides data for testHandle(). + */ public static function providerTestSetContentLengthHeader() { $response = new Response('Test content', 200); $response->headers->set('Content-Length', (string) strlen('Test content')); diff --git a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php index 4d36f8aa36ced5f84054d2301b1c2a850af8d2fb..dd1a70b76fc2a3421d6a920eda0037ab3e45da42 100644 --- a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php +++ b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php @@ -112,6 +112,9 @@ public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expec $this->assertEquals($expected_blocks, $result); } + /** + * Provides data to testGetVisibleBlocksPerRegion(). + */ public static function providerBlocksConfig() { $blocks_config = [ 'block1' => [ diff --git a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php index d9648265184e056026bfe0b92a0d769d1f7de8cb..871af6072fd437519a5ecd48d51b024b1f0ce3b5 100644 --- a/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php +++ b/core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @@ -66,6 +66,9 @@ public function setUpDisplayVariant($configuration = [], $definition = []) { return new BlockPageVariant($configuration, 'test', $definition, $this->blockRepository, $this->blockViewBuilder, ['config:block_list']); } + /** + * Provides data to testBuild(). + */ public static function providerBuild() { $blocks_config = [ 'block1' => [ diff --git a/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php b/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php index 49621be87fd7bc8617ea65cf3945ef3cc96743d7..f512c008ceeb79e33e2bd91bc6a905a5df52c3c2 100644 --- a/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php +++ b/core/modules/ckeditor5/tests/src/Unit/HTMLRestrictionsTest.php @@ -28,6 +28,9 @@ public function testConstructor(array $elements, ?string $expected_exception_mes $this->assertIsArray($restrictions->getAllowedElements(FALSE)); } + /** + * Provides data to testConstructor(). + */ public static function providerConstruct(): \Generator { // Fundamental structure. yield 'INVALID: list instead of key-value pairs' => [ @@ -167,6 +170,9 @@ public function testCounting(array $elements, bool $expected_is_empty, int $expe $this->assertCount($expected_concrete_plus_wildcard_count, $r->getAllowedElements(FALSE)); } + /** + * Provides data to testCounting(). + */ public static function providerCounting(): \Generator { yield 'empty' => [ [], @@ -257,6 +263,9 @@ public function testConvenienceConstructors($input, array $expected, ?array $exp $this->assertSame($expected_raw + $filter_html_additional_expectations, HTMLRestrictions::fromFilterPluginInstance($filter_plugin_instance->reveal())->getAllowedElements(FALSE)); } + /** + * Provides data to testConvenienceConstructors(). + */ public static function providerConvenienceConstructors(): \Generator { // All empty cases. yield 'empty string' => [ @@ -639,6 +648,9 @@ public function testRepresentations(HTMLRestrictions $restrictions, array $expec $this->assertSame($expected_ghs_config, $restrictions->toGeneralHtmlSupportConfig()); } + /** + * Provides data to testRepresentations(). + */ public static function providerRepresentations(): \Generator { yield 'empty set' => [ HTMLRestrictions::emptySet(), @@ -920,6 +932,9 @@ public function testOperations(HTMLRestrictions $a, HTMLRestrictions $b, $expect $this->assertEquals($expected_union, $a->merge($b)); } + /** + * Provides data to testOperations(). + */ public static function providerOperands(): \Generator { // Empty set operand cases. yield 'any set + empty set' => [ @@ -1678,6 +1693,9 @@ public function testSubsets(HTMLRestrictions $input, HTMLRestrictions $expected_ $this->assertEquals($expected_extracted_plain_tags_subset, $input->extractPlainTagsSubset()); } + /** + * Provides data to testSubsets(). + */ public static function providerSubsets(): \Generator { yield 'empty set' => [ new HTMLRestrictions([]), diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php index d00c44595dac226e345e0e2e50dc873baf2272cc..76c3578a41a0606d1dd294250c3433da9be3ace5 100644 --- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php +++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php @@ -333,6 +333,9 @@ protected function getMockNode($has_field, $comment_status, $form_location, $com if (!function_exists('history_read')) { + /** + * Gets a timestamp for the current user's last view of a specified node. + */ function history_read($nid) { return 0; } diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php index 07f2b29dd663627abfdf92b601cfcc2e8b2ae21b..a638add1049ed7b9020226fe7d5250c17b343fc0 100644 --- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php +++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php @@ -303,10 +303,16 @@ public function testGetType(): void { */ class DependencyFieldItem { + /** + * Gets the dependencies for this field item. + */ public static function calculateDependencies(FieldDefinitionInterface $definition) { return ['module' => ['test_module3']]; } + /** + * Informs the entity that entities it depends on will be deleted. + */ public static function onDependencyRemoval($field_config, $dependencies) { } diff --git a/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php b/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php index ef3dfb4767e1026f1e2abfc3764ab794a45da7f8..6fd395a23ef6ff360185bb769b7635d294886a3d 100644 --- a/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php +++ b/core/modules/file/tests/src/Unit/Plugin/migrate/process/d6/FileUriTest.php @@ -24,6 +24,9 @@ class FileUriTest extends MigrateTestCase { 'id' => 'test', ]; + /** + * Tests with a public scheme. + */ public function testPublic(): void { $value = [ 'sites/default/files/foo.jpg', @@ -34,6 +37,9 @@ public function testPublic(): void { $this->assertEquals('public://foo.jpg', $this->doTransform($value)); } + /** + * Tests with a base path that is not known. + */ public function testPublicUnknownBasePath(): void { $value = [ '/path/to/public/files/foo.jpg', @@ -44,6 +50,9 @@ public function testPublicUnknownBasePath(): void { $this->assertEquals('public://path/to/public/files/foo.jpg', $this->doTransform($value)); } + /** + * Tests with a private scheme. + */ public function testPrivate(): void { $value = [ 'sites/default/files/baz.gif', @@ -54,6 +63,9 @@ public function testPrivate(): void { $this->assertEquals('private://baz.gif', $this->doTransform($value)); } + /** + * Tests with a private base path that is not known. + */ public function testPrivateUnknownBasePath(): void { $value = [ '/path/to/private/files/baz.gif', @@ -64,6 +76,9 @@ public function testPrivateUnknownBasePath(): void { $this->assertEquals('private://path/to/private/files/baz.gif', $this->doTransform($value)); } + /** + * Tests the temporary scheme. + */ public function testTemporary(): void { $value = [ '/tmp/bar.png', @@ -74,6 +89,9 @@ public function testTemporary(): void { $this->assertEquals('temporary://bar.png', $this->doTransform($value)); } + /** + * Performs the transform process. + */ protected function doTransform(array $value) { $executable = new MigrateExecutable($this->getMigration()); $row = new Row(); diff --git a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php index e79c6d23b1bc880d5b4f927edbfb1211762298a1..25d31c500c6ef6e75ccd6fd76c15df506a82dc1a 100644 --- a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php +++ b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php @@ -171,6 +171,9 @@ public function testValidateNoMatchingFormats(): void { */ class FilterBaseTestableClass extends FilterBase { + /** + * {@inheritdoc} + */ public function process($text, $langcode) { return new FilterProcessResult(); } diff --git a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php index cf7388e7dccf3d3a7faa76945ab73c0680600e20..86236f3a47a5981d3459a4ff5d94c384348ad5a4 100644 --- a/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php +++ b/core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php @@ -151,6 +151,9 @@ public function testDefaultLangcode(ContentLanguageSettings $config, $expected): $this->assertSame($expected, $config->getDefaultLangcode()); } + /** + * Provides data to testDefaultLangcode(). + */ public static function providerDefaultLangcode() { $langcode = Random::machineName(); $config = new ContentLanguageSettings([ @@ -180,6 +183,9 @@ public function testLanguageAlterable(ContentLanguageSettings $config, $expected $this->assertSame($expected, $config->isLanguageAlterable()); } + /** + * Provides data to testLanguageAlterable(). + */ public static function providerLanguageAlterable() { $alterableConfig = new ContentLanguageSettings([ 'target_entity_type_id' => 'test_entity_type', @@ -214,6 +220,9 @@ public function testIsDefaultConfiguration(ContentLanguageSettings $config, $exp $this->assertSame($expected, $config->isDefaultConfiguration()); } + /** + * Provides data to testIsDefaultConfiguration(). + */ public static function providerIsDefaultConfiguration() { $alteredLanguage = new ContentLanguageSettings([ 'target_entity_type_id' => 'test_entity_type', @@ -281,6 +290,9 @@ public function testLoadByEntityTypeBundle($config_id, ?ContentLanguageSettings $this->assertSame($expected_language_alterable, $config->isLanguageAlterable()); } + /** + * Provides data to testLoadByEntityTypeBundle(). + */ public static function providerLoadByEntityTypeBundle() { $alteredLanguage = new ContentLanguageSettings([ 'target_entity_type_id' => 'test_entity_type', diff --git a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php index 0784b457a125ac2bcbcb4d916f21c41268719b91..8fb765cdcaad92d648ac5acc99f5f55bb8b8e9c9 100644 --- a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php +++ b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php @@ -345,6 +345,9 @@ public static function providerTestDomain() { if (!function_exists('base_path')) { + /** + * Returns the base path. + */ function base_path() { return '/'; } diff --git a/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php b/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php index efa52a8ec67e54c54e87d26b7de4ff76121de40f..176ffa13292b86271aa4443de134b9e933d46aa5 100644 --- a/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php +++ b/core/modules/locale/tests/src/Unit/LocaleBulkDeprecationTest.php @@ -14,6 +14,9 @@ */ class LocaleBulkDeprecationTest extends UnitTestCase { + /** + * {@inheritdoc} + */ protected function setUp(): void { parent::setUp(); diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php index 6b18a1bacb830dff395b6c63e8affa12e263d2d0..1cabbebdde6f088d1ae8918bf3830969f0988761 100644 --- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php +++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php @@ -122,14 +122,23 @@ class EntityTestDestination extends EntityContentBase { */ private $entity = NULL; + /** + * Sets the test entity. + */ public function setEntity($entity): void { $this->entity = $entity; } + /** + * Gets the test entity. + */ protected function getEntity(Row $row, array $old_destination_id_values) { return $this->entity; } + /** + * Gets the test entity ID. + */ public static function getEntityTypeId($plugin_id) { return 'foo'; } diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php index 610f5dbb5bf5f75618a43da0a4b4e5fff6947381..1dde373b8851d90cfa47b49c60704129c8a45f98 100644 --- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php +++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityRevisionTest.php @@ -110,14 +110,23 @@ class EntityRevisionTestDestination extends EntityRevision { */ private $entity = NULL; + /** + * Sets the test entity. + */ public function setEntity($entity): void { $this->entity = $entity; } + /** + * Gets the test entity. + */ protected function getEntity(Row $row, array $old_destination_id_values) { return $this->entity; } + /** + * Gets the test entity ID. + */ public static function getEntityTypeId($plugin_id) { return 'foo'; } diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php index 4176c39350243d34c0979688c00c44c3d3d85a40..ff185911cccba5c14007da3b85ea69cd04e23dd1 100644 --- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php +++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php @@ -59,14 +59,23 @@ protected function setUp(): void { */ class BaseFieldDefinitionTest extends BaseFieldDefinition { + /** + * {@inheritdoc} + */ public static function create($type) { return new static([]); } + /** + * {@inheritdoc} + */ public function getSettings() { return []; } + /** + * {@inheritdoc} + */ public function getType() { return 'integer'; } diff --git a/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php b/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php index 0ddee30853935959624cf9848145a239bb713266..296d615f6e2d9c1829cce19437a22b21124bb1ab 100644 --- a/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php +++ b/core/modules/migrate/tests/src/Unit/TestSqlIdMap.php @@ -82,7 +82,7 @@ protected function getFieldSchema(array $id_definition) { /** * {@inheritdoc} */ - // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod + // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod, Drupal.Commenting.FunctionComment.Missing public function ensureTables() { parent::ensureTables(); } diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php index 0c2b729e8b662803da050295c6223b8e53ddeb81..bac47cde2f20f389aba92cd926bd7788cecb7594 100644 --- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php @@ -71,11 +71,17 @@ public function __construct($entity) { $this->entity = $entity; } + /** + * Gets the test entity. + */ protected function getEntity($entity_type, $bundle, $view_mode) { $this->testValues = func_get_args(); return $this->entity; } + /** + * Gets the test values. + */ public function getTestValues() { return $this->testValues; } diff --git a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php index 0ce3f69e6bb328ef4615d67005b1c7debc4c9c37..774ba999baf62dc95d27cfd50ed3d1e7eadd7a63 100644 --- a/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php +++ b/core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php @@ -71,11 +71,17 @@ public function __construct($entity) { $this->entity = $entity; } + /** + * Gets the test entity. + */ protected function getEntity($entity_type, $bundle, $form_mode) { $this->testValues = func_get_args(); return $this->entity; } + /** + * Gets the test values. + */ public function getTestValues() { return $this->testValues; } diff --git a/core/modules/mysql/tests/src/Unit/InstallTasksTest.php b/core/modules/mysql/tests/src/Unit/InstallTasksTest.php index a50a6f010c76fc42a2d50faef81a41e36ddcf34f..90305518bee27b34ce9e2bdd3238433911ddb433 100644 --- a/core/modules/mysql/tests/src/Unit/InstallTasksTest.php +++ b/core/modules/mysql/tests/src/Unit/InstallTasksTest.php @@ -55,14 +55,23 @@ public function __construct(Connection $connection) { $this->connection = $connection; } + /** + * {@inheritdoc} + */ protected function isConnectionActive() { return TRUE; } + /** + * {@inheritdoc} + */ protected function getConnection() { return $this->connection; } + /** + * {@inheritdoc} + */ protected function t($string, array $args = [], array $options = []) { return $string; } @@ -79,14 +88,23 @@ protected function t($string, array $args = [], array $options = []) { private function createTasksNoConnection(): Tasks { return new class() extends Tasks { + /** + * {@inheritdoc} + */ protected function isConnectionActive() { return FALSE; } + /** + * {@inheritdoc} + */ protected function getConnection() { return NULL; } + /** + * {@inheritdoc} + */ protected function t($string, array $args = [], array $options = []) { return $string; } diff --git a/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php b/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php index af84befb7dab63302967039cedd69d59484c29b2..b54e663179a44b7f64475225ded1490dbf2eaa2f 100644 --- a/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php +++ b/core/modules/package_manager/tests/src/Unit/LoggingBeginnerTest.php @@ -18,6 +18,9 @@ */ class LoggingBeginnerTest extends UnitTestCase { + /** + * Tests the output of LoggingBeginner(). + */ public function testDecoratedBeginnerIsCalled(): void { $decorated = $this->createMock(BeginnerInterface::class); diff --git a/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php b/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php index 3d6ab55de0cf5c26252f35fd84852f8ab14179bb..83c19a1b8b66f7484bd3f47256c53774764dc81c 100644 --- a/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php +++ b/core/modules/package_manager/tests/src/Unit/LoggingCommitterTest.php @@ -18,6 +18,9 @@ */ class LoggingCommitterTest extends UnitTestCase { + /** + * Tests the output of LoggingCommitter(). + */ public function testDecoratedCommitterIsCalled(): void { $decorated = $this->createMock(CommitterInterface::class); diff --git a/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php b/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php index f21577c348d398415728d603fd5141ce2a98fe03..a7e6c050e1738ab6b24106e4f583190aaa579019 100644 --- a/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php +++ b/core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php @@ -18,6 +18,9 @@ */ class LoggingStagerTest extends UnitTestCase { + /** + * Tests LoggingStager(). + */ public function testDecoratedStagerIsCalled(): void { $decorated = $this->createMock(StagerInterface::class); diff --git a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php index 5b1c0c400b545ad101cf1b27450b64f2e11f11f3..7e0740473736ed89dcd05579c19bc4c88e19f29f 100644 --- a/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php +++ b/core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php @@ -53,6 +53,9 @@ public function testSerialization($data, $expected_response = FALSE): void { $this->assertEquals($expected_response !== FALSE ? $expected_response : Json::encode($data), $event->getResponse()->getContent()); } + /** + * Provides data to testSerialization(). + */ public static function providerTestSerialization() { return [ // The default data for \Drupal\rest\ResourceResponse. diff --git a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php index ce67ed1e00567518bdec6901b5cd024b5b9107a1..fdc9754f3bd1335e4cb8c956e69f17d464cfdc85 100644 --- a/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php +++ b/core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php @@ -321,6 +321,9 @@ public function __construct(array $values) { } } + /** + * {@inheritdoc} + */ public function label($langcode = NULL) { return $this->label; } diff --git a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php index e4da1fbde1fed1899ca3644f7873bf073c4fbafb..99130000b4040badd6aa4b3eef86c845b93d2c19 100644 --- a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php +++ b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php @@ -108,6 +108,9 @@ public function testDefaultEncoderHasSerializer(): void { */ class TestObject { + /** + * Return the characters "A". + */ public function getA() { return 'A'; } diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php index 4a805e19d6b343a0b7d5782bdecdbe775811cb73..9c6d8a52f5c869c16490a9c9d060f8993e027bc2 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php @@ -307,6 +307,9 @@ public static function jsonSchemaDataProvider(): array { */ class DateTimeIso8601NormalizerTestDrupalDateTime extends DrupalDateTime { + /** + * Sets the timezone. + */ public function setTimezone(\DateTimeZone $timezone) { parent::setTimezone($timezone); } diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php index 3527c5ef6ffdaaa98b898d63cbf59dacde1947b9..3082742e4a47ee8a9b7bec24b706b1ca9d700e9d 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php @@ -232,6 +232,9 @@ public static function jsonSchemaDataProvider(): array { */ class DateTimeNormalizerTestDrupalDateTime extends DrupalDateTime { + /** + * Sets the timezone. + */ public function setTimezone(\DateTimeZone $timezone) { parent::setTimezone($timezone); } diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php index 905598fea7869e5d5ac1cdb2b4cadd87feed4356..02ee2585da874a4309cc2fb68fe7139f466be28d 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php @@ -169,6 +169,9 @@ public function testNormalize(): void { $this->assertSame($expected, $normalized); } + /** + * Tests normalizing with an entity reference field. + */ public function testNormalizeWithNewEntityReference(): void { $test_url = '/test/100'; diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php index e0e4c991c470f01d37667c2f0d2c74a04acfab7e..60f6db35f7cec0c7255eea10e49ffa24edc23fe4 100644 --- a/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php +++ b/core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php @@ -172,6 +172,9 @@ public static function jsonSchemaDataProvider(): array { */ class TimestampNormalizerTestDrupalDateTime extends DrupalDateTime { + /** + * Sets the timezone. + */ public function setTimezone(\DateTimeZone $timezone) { parent::setTimezone($timezone); } diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php index e3745d48775533a9366f8b5ad55c17f3ada440a6..58a2a29e162c605851ec2cd846bd56b8908cf414 100644 --- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php +++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php @@ -419,6 +419,9 @@ public function setupAccessManagerToAllow(): void { ->willReturn((new AccessResultAllowed())->cachePerPermissions()); } + /** + * Prepares the mock processInbound() method. + */ protected function setupStubPathProcessor(): void { $this->pathProcessor->expects($this->any()) ->method('processInbound') @@ -437,11 +440,17 @@ class TestPathBasedBreadcrumbBuilder extends PathBasedBreadcrumbBuilder { */ protected LinkGeneratorInterface $linkGenerator; + /** + * {@inheritdoc} + */ public function setStringTranslation(TranslationInterface $string_translation) { $this->stringTranslation = $string_translation; return $this; } + /** + * Sets the link generator. + */ public function setLinkGenerator(LinkGeneratorInterface $link_generator): void { $this->linkGenerator = $link_generator; } diff --git a/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php b/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php index 2f67aa7a609de7355d232da7b184cf38c96089df..0486dffcc1e4211791912b3271bc38276f5e235e 100644 --- a/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php +++ b/core/modules/system/tests/src/Unit/FileTransfer/FileTransferTest.php @@ -27,6 +27,9 @@ protected function setUp(): void { $this->testConnection = TestFileTransfer::factory($this->root, []); } + /** + * Tests the value returned by __get(). + */ public function testFileTransferMagicMethods(): void { // Test to ensure __get() preserves public access. $this->assertInstanceOf(MockTestConnection::class, $this->testConnection->connection); diff --git a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php b/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php index 7cd8f89c11e08797257b7dc30a917e9302ca3bbf..bbb2c88a8897bde2a243318d8dcae3ee4d276a16 100644 --- a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php +++ b/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php @@ -30,6 +30,9 @@ public function testAlterRoutes(Route $route, $is_admin): void { $this->assertSame($is_admin, $route->getOption('_admin_route')); } + /** + * Provides data to testAlterRoutes(). + */ public static function providerTestAlterRoutes() { $data = []; $data['non-admin'] = [ diff --git a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php index 0a46196d1d46ef7b7e9bb250767b08fcabd7c385..c07756add0e1a6b1420a763f065e9e047ba1c387 100644 --- a/core/modules/user/tests/src/Unit/PermissionHandlerTest.php +++ b/core/modules/user/tests/src/Unit/PermissionHandlerTest.php @@ -358,12 +358,18 @@ protected function assertPermissions(array $actual_permissions): void { */ class TestPermissionCallbacks { + /** + * Callback that returns a single description. + */ public function singleDescription() { return [ 'access_module_a' => 'single_description', ]; } + /** + * Callback that returns the title and description. + */ public function titleDescription() { return [ 'access module b' => [ @@ -373,6 +379,9 @@ public function titleDescription() { ]; } + /** + * Callback that returns restricted access. + */ public function titleDescriptionRestrictAccess() { return [ 'access_module_c' => [ @@ -383,6 +392,9 @@ public function titleDescriptionRestrictAccess() { ]; } + /** + * Callback that returns the title. + */ public function titleProvider() { return [ 'access module a via module b' => [ diff --git a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php index c7dbd103ea10df83980b1a22200b8e88c5298442..75f7305e817306df53cd5cc39d31828decf295f7 100644 --- a/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/Block/ViewsBlockTest.php @@ -307,6 +307,9 @@ public function testBuildFailed(): void { if (!function_exists('views_add_contextual_links')) { + /** + * Define method views_add_contextual_links for this test. + */ function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) { } diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php index f2afff8e31dddd03b4c9e75565684c893080b042..489102c07eb9c7fc4e099f0adff11d1ec6b936f1 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php @@ -972,6 +972,9 @@ public function testElementClassesWithTokens(): void { */ class FieldPluginBaseTestField extends FieldPluginBase { + /** + * Set the link generator. + */ public function setLinkGenerator(LinkGeneratorInterface $link_generator): void { $this->linkGenerator = $link_generator; } @@ -983,6 +986,9 @@ public function setLinkGenerator(LinkGeneratorInterface $link_generator): void { if (!function_exists('base_path')) { + /** + * Returns the base path. + */ function base_path() { return '/'; } diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php index 128a5cefb7cf1528925595f432ba2c8351b24d56..d872bac6cac3834afa5b51b3e4d6068c2ae05e5f 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php @@ -762,6 +762,9 @@ protected function setupLanguageRenderer(EntityField $handler, $definition): voi */ class FieldTestEntityField extends EntityField { + /** + * {@inheritdoc} + */ public function executePrepareItemsByDelta(array $all_values) { return $this->prepareItemsByDelta($all_values); } diff --git a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php index 7dad710f44192b812a2898d6e9bd255aabb83dd3..edd524d3039c6a8406580bf479d10f3db3dc9a49 100644 --- a/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php @@ -36,6 +36,9 @@ class SqlBaseTest extends UnitTestCase { */ protected $display; + /** + * {@inheritdoc} + */ protected function setUp(): void { parent::setUp(); diff --git a/core/modules/views/tests/src/Unit/PluginBaseTest.php b/core/modules/views/tests/src/Unit/PluginBaseTest.php index b0b708a71d8e8352281131466758c7d049fe0c62..a78824176272121a939715ce3c6282910a0d7d08 100644 --- a/core/modules/views/tests/src/Unit/PluginBaseTest.php +++ b/core/modules/views/tests/src/Unit/PluginBaseTest.php @@ -290,6 +290,9 @@ public function testFilterByDefinedOptions($storage, $options, $expected_storage $this->assertEquals($expected_storage, $storage); } + /** + * Provides data to testFilterByDefinedOptions(). + */ public static function providerTestFilterByDefinedOptions() { $data = []; diff --git a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php index 07e8894e70740d8ca20ffcf94796fa13891646ba..aef3e8c11dd8b6e9df111f6f25905ed6378f70dd 100644 --- a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php +++ b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php @@ -206,6 +206,9 @@ public function testHandleWithArgumentsOnOverriddenRouteWithUpcasting(): void { if (!function_exists('views_add_contextual_links')) { + /** + * Define method views_add_contextual_links for this test. + */ function views_add_contextual_links(&$render_element, $location, $display_id, ?array $view_element = NULL) { } diff --git a/core/modules/views/tests/src/Unit/ViewsDataTest.php b/core/modules/views/tests/src/Unit/ViewsDataTest.php index d88891901899873b8e6f34c234364f740fc45020..aec182fb164d73bd0b20d3a9c23c0ed9a679b50b 100644 --- a/core/modules/views/tests/src/Unit/ViewsDataTest.php +++ b/core/modules/views/tests/src/Unit/ViewsDataTest.php @@ -649,6 +649,9 @@ public function testGetEmptyKey($key): void { $this->viewsData->get($key); } + /** + * Provides data to testGetEmptyKey(). + */ public static function providerTestGetEmptyKey() { return [ [NULL], diff --git a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php index b6a878eb54861520d06a4f3d0830ee302e7887c2..b51d5f1018f19386342005b1f1a0a54c2ef9d4c2 100644 --- a/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php +++ b/core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php @@ -202,6 +202,9 @@ public function testBuildRowEntityList(): void { */ class TestViewListBuilder extends ViewListBuilder { + /** + * {@inheritdoc} + */ public function buildOperations(EntityInterface $entity) { return []; } diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 7d3de555897de5423b0a952c7e53099cb7fb0e02..50039ecc171763ecaefdf1f47de7df424f463c98 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -70,6 +70,7 @@ <include-pattern>*/FunctionalJavascript/*</include-pattern> <include-pattern>*/Kernel/*</include-pattern> <include-pattern>*/Functional/*</include-pattern> + <include-pattern>*/Unit/*</include-pattern> </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"/> <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment">