From b39154338ee27590f0d4918863e06cb970d9c339 Mon Sep 17 00:00:00 2001 From: Ann Mary Sruthy <annmarysruthy2401@gmail.com> Date: Fri, 7 Feb 2025 15:53:06 +0530 Subject: [PATCH 1/3] Issue #3504774: Fix Drupal.Commenting.FunctionComment.MissingReturnComment in core/tests --- core/phpcs.xml.dist | 1 + .../MachineNameTransliterationTest.php | 2 ++ .../DefaultContent/ContentImportTest.php | 1 + .../Core/DrupalKernel/DrupalKernelTest.php | 2 ++ core/tests/Drupal/KernelTests/KernelTestBase.php | 2 ++ .../Drupal/Tests/Component/Datetime/TimeTest.php | 2 ++ .../Tests/Component/DrupalComponentTest.php | 2 ++ .../Tests/Component/Plugin/PluginBaseTest.php | 6 ++++++ .../Component/Render/FormattableMarkupTest.php | 1 + .../Drupal/Tests/Component/Utility/CryptTest.php | 16 +++++++++++++--- .../Tests/Component/Utility/ReflectionTest.php | 3 +++ .../Tests/Component/Utility/UrlHelperTest.php | 16 +++++++++++++++- .../Drupal/Tests/Component/Uuid/UuidTest.php | 1 + .../Plugin/Scaffold/ScaffoldTestResult.php | 2 ++ .../Tests/Core/Routing/RouteMatchTestBase.php | 1 + .../Tests/Core/Routing/RoutingFixtures.php | 5 +++++ .../Core/Routing/TrustedRedirectResponseTest.php | 1 + .../Tests/Core/Routing/UrlGeneratorTest.php | 1 + core/tests/Drupal/Tests/EntityViewTrait.php | 1 + core/tests/Drupal/Tests/PerformanceData.php | 1 + core/tests/Drupal/Tests/PerformanceTestTrait.php | 2 ++ .../tests/Drupal/Tests/TestRequirementsTrait.php | 1 + core/tests/Drupal/Tests/WebAssert.php | 2 ++ 23 files changed, 68 insertions(+), 4 deletions(-) diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 9b9bc8bd92c1..6953a1ad1ec8 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -85,6 +85,7 @@ <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment"> <include-pattern>core/lib/Drupal/Core/*</include-pattern> <include-pattern>core/lib/Drupal/Component/*</include-pattern> + <include-pattern>core/tests/*</include-pattern> </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment"> <exclude-pattern>core/lib/Drupal/Core/*</exclude-pattern> diff --git a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php index 3d4483a4f3a6..ad9ba4f89d8e 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php @@ -66,6 +66,8 @@ public function testMachineNameTransliterations($langcode, $input, $output): voi * Data for the testMachineNameTransliterations. * * @return array + * An array of arrays, where each sub-array contains a language code, + * input string, and the expected transliterated output string. */ public static function machineNameInputOutput(): array { return [ diff --git a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php index 8a3078733c50..06de4e64394d 100644 --- a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php +++ b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php @@ -127,6 +127,7 @@ protected function setUp(): void { /** * @return array<array<mixed>> + * An array of test cases, each containing an existing entity handling mode. */ public static function providerImportEntityThatAlreadyExists(): array { return [ diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php index 343b9f19630d..3be9b023b2f7 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php @@ -205,6 +205,8 @@ public function testPreventChangeOfSitePath(): void { * Data provider for self::testClassLoaderAutoDetect. * * @return array + * An array of test cases. Each test case is an array containing a single boolean value + * that represents the class_loader_auto_detect setting to be tested. */ public static function providerClassLoaderAutoDetect() { return [ diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 843ec4a3999d..bedc836e0f9e 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -296,6 +296,7 @@ protected function setUpFilesystem() { /** * @return string + * The database prefix string used to isolate test database tables. */ public function getDatabasePrefix() { return $this->databasePrefix; @@ -971,6 +972,7 @@ protected function vfsDump() { * The fully-qualified class name of this test. * * @return array + * An array of modules to install. */ private static function getModulesToEnable($class) { $modules = []; diff --git a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php index f793e3a9460d..c09a46d6116c 100644 --- a/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php +++ b/core/tests/Drupal/Tests/Component/Datetime/TimeTest.php @@ -134,6 +134,7 @@ public function testGetCurrentMicroTime(): void { * Shadow time() system call. * * @return int + * The fixed integer timestamp used for testing purposes. */ function time() { return 12345678; @@ -143,6 +144,7 @@ function time() { * Shadow microtime system call. * * @return float + * The fixed float timestamp used for testing purposes. */ function microtime(bool $as_float = FALSE) { return 1234567.89; diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php index e6260eead05d..4ffa430c05b5 100644 --- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php +++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php @@ -52,6 +52,8 @@ public function testComponentLicense(string $component_path): void { * Data provider. * * @return array + * An associative array where the keys are component names and the values + * are arrays containing the corresponding component path. */ public static function getComponents(): array { $root_component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/lib/Drupal/Component'; diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php index 51ff3575f969..42aa7863f2da 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php @@ -30,6 +30,8 @@ public function testGetPluginId($plugin_id, $expected): void { * Returns test data for testGetPluginId(). * * @return array + * An array of test cases, where each item contains a plugin ID and + * the expected plugin ID result. */ public static function providerTestGetPluginId() { return [ @@ -56,6 +58,8 @@ public function testGetBaseId($plugin_id, $expected): void { * Returns test data for testGetBaseId(). * * @return array + * An array of test cases, where each item contains a plugin ID and + * the expected base ID result. */ public static function providerTestGetBaseId() { return [ @@ -82,6 +86,8 @@ public function testGetDerivativeId($plugin_id = NULL, $expected = NULL): void { * Returns test data for testGetDerivativeId(). * * @return array + * An array of test cases, where each item contains a plugin ID and + * the expected derivative ID result. */ public static function providerTestGetDerivativeId() { return [ diff --git a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php index 7962148796e0..5120d0e78c0e 100644 --- a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php @@ -93,6 +93,7 @@ public function testUnexpectedPlaceholder($string, $arguments, $error_number, $e * Data provider for FormattableMarkupTest::testUnexpectedPlaceholder(). * * @return array + * An array of test cases. */ public static function providerTestUnexpectedPlaceholder() { return [ diff --git a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php index 8dcc87f4462e..7aff98aab423 100644 --- a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php @@ -69,7 +69,10 @@ public function testHmacBase64Invalid($data, $key): void { /** * Provides data for self::testHashBase64(). * - * @return array Test data. + * @return array + * An array of test cases. Each test case contains: + * - string $data: The input string to hash. + * - string $expected_hash: The expected Base64-encoded hash value. */ public static function providerTestHashBase64() { return [ @@ -89,7 +92,11 @@ public static function providerTestHashBase64() { /** * Provides data for self::testHmacBase64(). * - * @return array Test data. + * @return array + * An array of test cases. Each test case contains: + * - string $data: The input string to hash. + * - string $key: The key to use in the hashing process. + * - string $expected_hmac: The expected Base64-encoded HMAC value. */ public static function providerTestHmacBase64() { return [ @@ -105,7 +112,10 @@ public static function providerTestHmacBase64() { /** * Provides data for self::testHmacBase64(). * - * @return array Test data. + * @return array + * An array of test cases. Each test case contains: + * - string $data: The input string to hash. + * - string $key: The key to use in the hashing process. */ public static function providerTestHmacBase64Invalid() { return [ diff --git a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php index c1ea6045939e..4a0a6fb4b854 100644 --- a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php @@ -30,6 +30,9 @@ public function testGetParameterClassName(?string $expected, \ReflectionParamete * Data provider for ::testGetParameterClassName(). * * @return array[] + * An array of test cases. Each test case is an associative array containing: + * - string|null $expected: The expected class name. + * - \ReflectionParameter $parameter: The reflection parameter. */ public static function providerGetParameterClassName() { $reflection_method = new \ReflectionMethod(static::class, 'existsForTesting'); diff --git a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php index 8e77ae27467a..158e626c8213 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php @@ -18,6 +18,10 @@ class UrlHelperTest extends TestCase { * Provides test data for testBuildQuery(). * * @return array + * An array of test cases. Each test case contains: + * - array $query: An array of query parameters. + * - string $expected: The expected query string. + * - string $message: The assertion message. */ public static function providerTestBuildQuery() { return [ @@ -50,6 +54,7 @@ public function testBuildQuery($query, $expected, $message): void { * Data provider for testValidAbsolute(). * * @return array + * An array of valid absolute URLs, with various schemes applied. */ public static function providerTestValidAbsoluteData(): array { $urls = [ @@ -99,6 +104,7 @@ public function testValidAbsolute(string $url, string $scheme): void { * Provides data for testInvalidAbsolute(). * * @return array + * An array of invalid absolute URLs. */ public static function providerTestInvalidAbsolute(): array { $data = [ @@ -154,6 +160,7 @@ public function testInvalidAbsolute(string $url, string $scheme): void { * Provides data for testValidRelative(). * * @return array + * An array of valid relative URLs. */ public static function providerTestValidRelativeData(): array { $data = [ @@ -188,6 +195,7 @@ public function testValidRelative(string $url, string $prefix): void { * Provides data for testInvalidRelative(). * * @return array + * An array of invalid relative URLs. */ public static function providerTestInvalidRelativeData(): array { $data = [ @@ -239,8 +247,9 @@ public function testFilterQueryParameters($query, $exclude, $expected): void { * Provides data to self::testFilterQueryParameters(). * * @return array + * An array of test cases with query parameters, exclusions, and expected results. */ - public static function providerTestFilterQueryParameters() { + public static function providerTestFilterQueryParameters(): array { return [ // Test without an exclude filter. [ @@ -277,6 +286,7 @@ public function testParse($url, $expected): void { * Provides data for self::testParse(). * * @return array + * An array of test cases with URLs and expected parsed results. */ public static function providerTestParse() { return [ @@ -399,6 +409,7 @@ public function testEncodePath($path, $expected): void { * Provides data for self::testEncodePath(). * * @return array + * An array of test cases with unencoded paths and expected encoded paths. */ public static function providerTestEncodePath() { return [ @@ -427,6 +438,7 @@ public function testIsExternal($path, $expected): void { * Provides data for self::testIsExternal(). * * @return array + * An array of test cases with paths and their expected external status. */ public static function providerTestIsExternal() { return [ @@ -491,6 +503,7 @@ public function testFilterBadProtocol($uri, $expected, $protocols): void { * Provides data for self::testTestFilterBadProtocol(). * * @return array + * An array of test cases with URIs, expected filtered results, and allowed protocols. */ public static function providerTestFilterBadProtocol() { return [ @@ -529,6 +542,7 @@ public function testStripDangerousProtocols($uri, $expected, $protocols): void { * Provides data for self::testStripDangerousProtocols(). * * @return array + * An array of test cases with URIs, expected stripped results, and allowed protocols. */ public static function providerTestStripDangerousProtocols() { return [ diff --git a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php index a0c2dd8b9cda..1d1f0b402322 100644 --- a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php +++ b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php @@ -40,6 +40,7 @@ public function testUuidIsUnique(UuidInterface $instance): void { * Data provider for UUID instance tests. * * @return array + * An array of UUID generator instances. */ public static function providerUuidInstances() { diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php index f474e95074c2..e8b009c5c38a 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php @@ -40,6 +40,7 @@ public function __construct($docroot, $scaffoldOutput) { * Returns the location of the docroot from the scaffold test. * * @return string + * The location of the scaffold fixture. */ public function docroot() { return $this->docroot; @@ -49,6 +50,7 @@ public function docroot() { * Returns the standard output from the scaffold test. * * @return string + * The standard output from the scaffold test. */ public function scaffoldOutput() { return $this->scaffoldOutput; diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php index 8fffba927ecb..abb0bda7994f 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php +++ b/core/tests/Drupal/Tests/Core/Routing/RouteMatchTestBase.php @@ -28,6 +28,7 @@ abstract class RouteMatchTestBase extends UnitTestCase { * Raw parameters array * * @return \Drupal\Core\Routing\RouteMatchInterface + * The constructed route match instance. */ abstract protected static function getRouteMatch(string $name, Route $route, array $parameters, array $raw_parameters): RouteMatchInterface; diff --git a/core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php b/core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php index 990a0addd0ac..1c5e033f425a 100644 --- a/core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php +++ b/core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php @@ -83,6 +83,7 @@ public function staticSampleRouteCollection() { * Returns a standard set of routes for testing. * * @return \Symfony\Component\Routing\RouteCollection + * An array of of predefined routes for testing. */ public function sampleRouteCollection() { $collection = new RouteCollection(); @@ -115,6 +116,7 @@ public function sampleRouteCollection() { * Returns a complex set of routes for testing. * * @return \Symfony\Component\Routing\RouteCollection + * A RouteCollection with varied route structures. */ public function complexRouteCollection() { $collection = new RouteCollection(); @@ -145,6 +147,7 @@ public function complexRouteCollection() { * Returns a complex set of routes for testing. * * @return \Symfony\Component\Routing\RouteCollection + * A RouteCollection containing routes with mixed casing and Unicode characters. */ public function mixedCaseRouteCollection() { $collection = new RouteCollection(); @@ -179,6 +182,7 @@ public function mixedCaseRouteCollection() { * Returns a complex set of routes for testing. * * @return \Symfony\Component\Routing\RouteCollection + * A RouteCollection containing duplicate paths with different route names. */ public function duplicatePathsRouteCollection() { $collection = new RouteCollection(); @@ -217,6 +221,7 @@ public function duplicatePathsRouteCollection() { * Returns a Content-type restricted set of routes for testing. * * @return \Symfony\Component\Routing\RouteCollection + * A RouteCollection containing routes with Content-type restrictions for testing. */ public function contentRouteCollection() { $collection = new RouteCollection(); diff --git a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php index fb6183466a5c..ef5d674f605d 100644 --- a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php @@ -74,6 +74,7 @@ public function testCreateFromRedirectResponse($redirect_response): void { /** * @return array + * An array of test cases, each containing a redirect response instance. */ public static function providerCreateFromRedirectResponse() { return [ diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 26c3b7663a56..97cb548fa468 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -186,6 +186,7 @@ protected function setUp(): void { * to return an actual alias. * * @return string + * The alias for the given path, or the path itself if no alias is defined. */ public function aliasManagerCallback() { $args = func_get_args(); diff --git a/core/tests/Drupal/Tests/EntityViewTrait.php b/core/tests/Drupal/Tests/EntityViewTrait.php index a1568119f8b6..b4952249db89 100644 --- a/core/tests/Drupal/Tests/EntityViewTrait.php +++ b/core/tests/Drupal/Tests/EntityViewTrait.php @@ -32,6 +32,7 @@ trait EntityViewTrait { * the current content language. * * @return array + * The fully built render array of the entity. * * @see \Drupal\Core\Render\RendererInterface::render() */ diff --git a/core/tests/Drupal/Tests/PerformanceData.php b/core/tests/Drupal/Tests/PerformanceData.php index dad60e1be352..17e01d1c1265 100644 --- a/core/tests/Drupal/Tests/PerformanceData.php +++ b/core/tests/Drupal/Tests/PerformanceData.php @@ -230,6 +230,7 @@ public function getCacheGetCount(): int { * List of cids keyed by operation and bin. * * @return void + * No return value. */ public function setCacheOperations(array $cacheOperations): void { $this->cacheOperations = $cacheOperations; diff --git a/core/tests/Drupal/Tests/PerformanceTestTrait.php b/core/tests/Drupal/Tests/PerformanceTestTrait.php index 914144dd5371..8eff364de15b 100644 --- a/core/tests/Drupal/Tests/PerformanceTestTrait.php +++ b/core/tests/Drupal/Tests/PerformanceTestTrait.php @@ -612,6 +612,7 @@ private function openTelemetryTracing(array $messages, string $service_name): vo * The message to display. * * @return void + * No return value. * * @throws \PHPUnit\Framework\ExpectationFailedException */ @@ -653,6 +654,7 @@ protected static function isDatabaseCache(DatabaseEvent $event): bool { * An instance of the performance data value object. * * @return void + * No return value. */ protected function assertMetrics( array $expected, diff --git a/core/tests/Drupal/Tests/TestRequirementsTrait.php b/core/tests/Drupal/Tests/TestRequirementsTrait.php index 04c2eb411dba..579419da58e5 100644 --- a/core/tests/Drupal/Tests/TestRequirementsTrait.php +++ b/core/tests/Drupal/Tests/TestRequirementsTrait.php @@ -17,6 +17,7 @@ trait TestRequirementsTrait { * Returns the Drupal root directory. * * @return string + * The Drupal root directory. */ protected static function getDrupalRoot(): string { return dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)), 2); diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php index 248da850b7cb..79195aab829e 100644 --- a/core/tests/Drupal/Tests/WebAssert.php +++ b/core/tests/Drupal/Tests/WebAssert.php @@ -53,6 +53,7 @@ public function __construct(Session $session, $base_url = '') { * Whether to include the query string in the return value. * * @return string + * The cleaned URL with the base URL removed and formatted consistently. */ protected function cleanUrl(string|Url $url, bool $include_query = FALSE) { if ($url instanceof Url) { @@ -769,6 +770,7 @@ public function pageContainsNoDuplicateId() { * A url string, or object. * * @return void + * No return value. * * @throws \Behat\Mink\Exception\ExpectationException */ -- GitLab From 57d5005771ef7f356f861f05d9875a5b6095afd1 Mon Sep 17 00:00:00 2001 From: Ann Mary Sruthy <annmarysruthy2401@gmail.com> Date: Fri, 7 Feb 2025 20:23:01 +0530 Subject: [PATCH 2/3] Issue #3504774: Fix Drupal.Commenting.FunctionComment.MissingReturnComment in more core/tests --- core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php | 1 + core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php | 1 + core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php | 1 + core/tests/Drupal/Tests/Core/Access/AccessResultTest.php | 1 + core/tests/Drupal/Tests/Core/Common/AttributesTest.php | 1 + core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php | 4 ++++ core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php | 1 + core/tests/Drupal/Tests/Core/Form/OptGroupTest.php | 1 + core/tests/Drupal/Tests/Core/Image/ImageTest.php | 2 ++ core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php | 1 + .../Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php | 1 + .../Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php | 1 + .../Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php | 1 + .../Tests/Core/RouteProcessor/RouteProcessorManagerTest.php | 1 + core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php | 1 + core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php | 1 + .../Tests/Core/TypedData/RecursiveContextualValidatorTest.php | 2 ++ 17 files changed, 22 insertions(+) diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index 5e43c0bea2c5..1c65e7f96429 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -79,6 +79,7 @@ protected function setUp(): void { * Creates a test entity. * * @return \Drupal\Core\Entity\EntityInterface + * The created entity. */ protected function createTestEntity($entity_type): EntityInterface { $this->entityName = $this->randomMachineName(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php index 270c1c8f71f8..260ada5cc795 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php @@ -22,6 +22,7 @@ class EntityTypeTest extends KernelTestBase { * An array of values to use for the EntityType. * * @return \Drupal\Core\Entity\EntityTypeInterface + * The EntityType object. */ protected function setUpEntityType($definition) { $definition += [ diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php index fe6222df3cef..913f83004e8c 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php @@ -506,6 +506,7 @@ public function testCheckException($return_value): void { * Data provider for testCheckException. * * @return array + * An array of data for check exceptions. */ public static function providerCheckException() { return [ diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index 5ae1dddc7672..7d06831a40b4 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -940,6 +940,7 @@ public function testAllowedIfHasPermissions($permissions, $conjunction, AccessRe * Provides data for the testAllowedIfHasPermissions() method. * * @return array + * An array of test scenarios with permissions, logic, and expected result. */ public static function providerTestAllowedIfHasPermissions() { $access_result = AccessResult::allowedIf(FALSE); diff --git a/core/tests/Drupal/Tests/Core/Common/AttributesTest.php b/core/tests/Drupal/Tests/Core/Common/AttributesTest.php index e051a1338bb3..6a65be7f0460 100644 --- a/core/tests/Drupal/Tests/Core/Common/AttributesTest.php +++ b/core/tests/Drupal/Tests/Core/Common/AttributesTest.php @@ -18,6 +18,7 @@ class AttributesTest extends UnitTestCase { * Provides data for the Attribute test. * * @return array + * An array of attributes, expected output, and descriptions. */ public static function providerTestAttributeData() { return [ diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php index 7299a0a6cac7..931874ef8908 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php @@ -678,6 +678,8 @@ public function testChildAccessInheritance($element, $access_checks): void { * Data provider for testChildAccessInheritance. * * @return array + * An array of test cases, each containing a form element structure and + * its expected access results. */ public static function providerTestChildAccessInheritance() { $data = []; @@ -985,6 +987,8 @@ public function testFormTokenCacheability($token, $is_authenticated, $method, $o * Data provider for testFormTokenCacheability. * * @return array + * An array of test cases, each containing a form token, the authentication, + * request method, and expected cacheability outcome. */ public static function providerTestFormTokenCacheability() { return [ diff --git a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php index ebeffbc8f17c..38614f06204e 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php @@ -262,6 +262,7 @@ public function testExecuteSubmitHandlers(): void { /** * @return \Drupal\Core\Form\FormSubmitterInterface + * A mocked instance of FormSubmitter. */ protected function getFormSubmitter() { $request_stack = new RequestStack(); diff --git a/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php b/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php index bdba83a68910..87435ffe903a 100644 --- a/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php +++ b/core/tests/Drupal/Tests/Core/Form/OptGroupTest.php @@ -26,6 +26,7 @@ public function testFlattenOptions($options): void { * Provides test data for the flattenOptions() method. * * @return array + * An array of option structures to be flattened. */ public static function providerTestFlattenOptions() { $object1 = new \stdClass(); diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php index 673aeb534eb6..dde3e5728cb2 100644 --- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -62,6 +62,7 @@ protected function setUp(): void { * (optional) Array containing methods to be replaced with stubs. * * @return \PHPUnit\Framework\MockObject\MockObject + * Mocked GDToolkit instance. */ protected function getToolkitMock(array $stubs = []) { $mock_builder = $this->getMockBuilder('Drupal\system\Plugin\ImageToolkit\GDToolkit'); @@ -81,6 +82,7 @@ protected function getToolkitMock(array $stubs = []) { * The image toolkit object. * * @return \PHPUnit\Framework\MockObject\MockObject + * Mocked GDToolkit operation instance. */ protected function getToolkitOperationMock($class_name, ImageToolkitInterface $toolkit) { $mock_builder = $this->getMockBuilder('Drupal\system\Plugin\ImageToolkit\Operation\gd\\' . $class_name); diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 4b9504eb3b35..6a35e40e1da0 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -362,6 +362,7 @@ protected function getLocalTasksForRouteResult($mock_plugin): array { * Returns the cache entry expected when running getLocalTaskForRoute(). * * @return array + * The expected cache entry. */ protected function getLocalTasksCache(): array { $local_task_fixtures = $this->getLocalTaskFixtures(); diff --git a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php index a4f169b1565f..589338119406 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php +++ b/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php @@ -105,6 +105,7 @@ public function returnPluginMap($plugin_id) { * The plugin definition. * * @return \Drupal\Component\Plugin\PluginInspectionInterface|\PHPUnit\Framework\MockObject\MockObject + * The mocked plugin object. */ protected function getPluginMock($plugin_id, array $definition) { // Create a mock plugin instance. diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php index 41976c89e00c..e16672c8dbe3 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php @@ -209,6 +209,7 @@ protected function themeHandler() { /** * @return array[] + * The dependencies. */ public function getDependencies() { return $this->dependencies; diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php index 459d26de709a..779877a2a4e4 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php @@ -29,6 +29,7 @@ public function testGetFormClass(PluginWithFormsInterface $block_plugin, $operat /** * @return array + * Test cases for different block plugins and operations, mapping them to expected form classes. */ public static function providerGetFormClass() { $block_plugin_without_forms = new TestClass([], 'block_plugin_without_forms', [ diff --git a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php index 625814a39c9e..0f0b4548cef5 100644 --- a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php +++ b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php @@ -68,6 +68,7 @@ public function testRouteProcessorManager(): void { * The parameters to use in mock with() expectation. * * @return \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface|\PHPUnit\Framework\MockObject\MockObject + * The mock processor object. */ protected function getMockProcessor($route_name, $route, $parameters) { $processor = $this->createMock('Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface'); diff --git a/core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php b/core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php index f7e417875e18..68b53ebd82fd 100644 --- a/core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Test/WebDriverTestBaseTest.php @@ -47,6 +47,7 @@ public function testCapabilities($expected, ?string $mink_driver_args_webdriver, * environment variable will be unset. * * @return void + * No return value. */ private function putEnv(string $variable, ?string $value): void { if (is_string($value)) { diff --git a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php index 62ebf8d1ccbe..a64de47cf1f5 100644 --- a/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php @@ -218,6 +218,7 @@ public function testDetermineActiveThemeWithNotApplyingNegotiator(): void { * An array of negotiator IDs. * * @return \Drupal\Core\Theme\ThemeNegotiator + * The theme negotiator. */ protected function createThemeNegotiator(array $negotiators) { $resolver = new ClassResolver($this->container); diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php index f43d9bcd7dca..105907b29c67 100644 --- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php @@ -190,6 +190,7 @@ public function testPropertiesValidateWithMultipleLevels(): void { * The name to use for the object. * * @return \Drupal\Core\TypedData\TypedDataInterface|\PHPUnit\Framework\MockObject\MockObject + * The typed data object. */ protected function setupTypedData(array $tree, $name = '') { $callback = function ($value, ExecutionContextInterface $context) { @@ -310,6 +311,7 @@ public function testValidatePropertyValue(): void { * Builds some example type data object. * * @return \Drupal\Core\TypedData\TypedDataInterface|\PHPUnit\Framework\MockObject\MockObject + * A typed data object with nested properties for testing purposes. */ protected function buildExampleTypedDataWithProperties($subkey_value = NULL) { $subkey_value = $subkey_value ?: ['subkey1' => 'subvalue1', 'subkey2' => 'subvalue2']; -- GitLab From ba0cf475283218768a52e8099a7706cd19bc39c2 Mon Sep 17 00:00:00 2001 From: Ann Mary Sruthy <annmarysruthy2401@gmail.com> Date: Mon, 10 Feb 2025 15:17:06 +0530 Subject: [PATCH 3/3] Issue #3504774: Fix Drupal.Commenting.FunctionComment.MissingReturnComment in core/tests --- core/tests/Drupal/BuildTests/Framework/BuildTestBase.php | 4 ++++ .../Component/Render/FormattableMarkupKernelTest.php | 2 ++ .../tests/Drupal/KernelTests/Config/Schema/MappingTest.php | 1 + .../Asset/ResolvedLibraryDefinitionsFilesMatchTest.php | 1 + .../Core/Config/ConfigEntityValidationTestBase.php | 2 ++ .../Core/Database/DriverSpecificConnectionUnitTestBase.php | 1 + .../KernelTests/Core/Routing/ExceptionHandlingTest.php | 1 + .../Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php | 6 ++++++ core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php | 1 + core/tests/Drupal/Tests/ComposerIntegrationTest.php | 2 ++ .../Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php | 1 + core/tests/Drupal/Tests/Core/Cache/CacheTest.php | 5 +++++ .../Drupal/Tests/Core/Cache/CacheableMetadataTest.php | 3 +++ .../Tests/Core/Cache/Context/CacheContextsManagerTest.php | 1 + .../Core/Cache/Context/IsFrontPathCacheContextTest.php | 1 + .../Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php | 1 + .../Tests/Core/Config/Entity/ConfigEntityStorageTest.php | 4 ++++ .../Tests/Core/Config/Entity/ConfigEntityTypeTest.php | 1 + .../Drupal/Tests/Core/Config/StorageCopyTraitTest.php | 1 + core/tests/Drupal/Tests/Core/Database/ConditionTest.php | 1 + .../Drupal/Tests/Core/Database/RowCountExceptionTest.php | 1 + .../Compiler/BackendCompilerPassTest.php | 3 +++ .../DependencyInjection/Compiler/StackedKernelPassTest.php | 1 + .../Tests/Core/Entity/EntityCreateAccessCheckTest.php | 1 + core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php | 1 + core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php | 1 + .../tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php | 1 + .../Entity/KeyValueStore/KeyValueEntityStorageTest.php | 4 ++++ .../Core/Entity/Routing/DefaultHtmlRouteProviderTest.php | 1 + .../Tests/Core/Entity/Sql/DefaultTableMappingTest.php | 1 + core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php | 1 + core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php | 1 + .../Drupal/Tests/Core/Render/BubbleableMetadataTest.php | 7 +++++++ .../Drupal/Tests/Core/Render/ElementInfoManagerTest.php | 1 + core/tests/Drupal/Tests/Core/Render/ElementTest.php | 1 + .../Render/Placeholder/ChainedPlaceholderStrategyTest.php | 1 + .../Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php | 1 + .../Drupal/Tests/Core/Render/RendererBubblingTest.php | 1 + .../Drupal/Tests/Core/Render/RendererPlaceholdersTest.php | 2 ++ core/tests/Drupal/Tests/Core/Render/RendererTest.php | 4 ++++ .../Drupal/Tests/Core/Security/RequestSanitizerTest.php | 1 + .../Tests/Core/Session/AccessPolicyProcessorTest.php | 1 + .../Drupal/Tests/Core/Session/SessionConfigurationTest.php | 1 + core/tests/Drupal/Tests/Core/Site/SettingsTest.php | 1 + .../Core/StringTranslation/TranslationManagerTest.php | 2 ++ .../tests/Drupal/Tests/Core/Template/TwigExtensionTest.php | 3 +++ core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php | 1 + .../Tests/Core/Transliteration/PhpTransliterationTest.php | 1 + core/tests/Drupal/Tests/Core/UrlTest.php | 1 + core/tests/Drupal/Tests/Core/Utility/ErrorTest.php | 1 + .../Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php | 1 + core/tests/Drupal/Tests/TestFileCreationTrait.php | 1 + 52 files changed, 90 insertions(+) diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php index 313c6f54fa9d..e92c75468843 100644 --- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php +++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php @@ -223,6 +223,7 @@ protected function getWorkingPath($working_dir = NULL) { * Set up the Mink session manager. * * @return \Behat\Mink\Session + * The Mink session. */ protected function initMink() { $client = new DrupalTestBrowser(); @@ -327,6 +328,7 @@ public function assertCommandExitCode($expected_code) { * execute the command. Defaults to the workspace directory. * * @return \Symfony\Component\Process\Process + * The process object. */ public function executeCommand($command_line, $working_dir = NULL) { $this->commandProcess = Process::fromShellCommandline($command_line); @@ -510,6 +512,7 @@ protected function findAvailablePort(): int { * A number between 1024 and 65536. * * @return bool + * TRUE if the port is available, FALSE otherwise. */ protected function checkPortIsAvailable($port): bool { $fp = @fsockopen(self::$hostName, $port, $errno, $errstr, 1); @@ -531,6 +534,7 @@ protected function checkPortIsAvailable($port): bool { * Test should never call this. Used by standUpServer(). * * @return int + * The port number. */ protected function getPortNumber(): int { if (empty($this->hostPort)) { diff --git a/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php b/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php index 104294b39398..68d749ad9216 100644 --- a/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php +++ b/core/tests/Drupal/KernelTests/Component/Render/FormattableMarkupKernelTest.php @@ -51,6 +51,7 @@ public function testFormattableMarkupUri($string, $uri, $options, $expected): vo /** * @return array + * Data provider for testFormattableMarkupUri(). */ public static function providerTestFormattableMarkupUri() { $data = []; @@ -113,6 +114,7 @@ public function testFormattableMarkupUriWithExceptionUri($string, $uri): void { /** * @return array + * Data provider for testFormattableMarkupUriWithExceptionUri(). */ public static function providerTestFormattableMarkupUriWithException() { $data = []; diff --git a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php index f405783ceb18..cd0f2473bdc3 100644 --- a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php +++ b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php @@ -167,6 +167,7 @@ public function testMappingInterpretation( * @see https://www.drupal.org/files/ConfigSchemaCheatSheet2.0.pdf * * @return \Generator + * The test cases. */ public static function providerMappingInterpretation(): \Generator { $available_block_settings_types = [ diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index b4fdc8fc8538..340dcc286494 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -204,6 +204,7 @@ protected function verifyLibraryFilesExist($library_definitions): void { * Gets all libraries for core and all installed modules. * * @return \Drupal\Core\Extension\Extension[] + * An array of discovered libraries keyed by extension name. */ protected function getAllLibraries() { $modules = \Drupal::moduleHandler()->getModuleList(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php index 846405cf508c..18cd991e38d8 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityValidationTestBase.php @@ -496,6 +496,7 @@ public function testImmutableProperties(array $valid_values = []): void { * @todo Remove this optional parameter in https://www.drupal.org/project/drupal/issues/2820364#comment-15333069 * * @return void + * No return value. */ public function testRequiredPropertyKeysMissing(?array $additional_expected_validation_errors_when_missing = NULL): void { $config_entity_properties = array_keys($this->entity->getEntityType()->getPropertiesToExport()); @@ -541,6 +542,7 @@ public function testRequiredPropertyKeysMissing(?array $additional_expected_vali * @todo Remove this optional parameter in https://www.drupal.org/project/drupal/issues/2820364#comment-15333069 * * @return void + * No return value. */ public function testRequiredPropertyValuesMissing(?array $additional_expected_validation_errors_when_missing = NULL): void { $config_entity_properties = array_keys($this->entity->getEntityType()->getPropertiesToExport()); diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php index 596debea8bba..2af1bec7d0dc 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificConnectionUnitTestBase.php @@ -68,6 +68,7 @@ abstract protected function getQuery(): array; * Returns the connection ID of the current test connection. * * @return int + * The connection ID. */ protected function getConnectionId(): int { return (int) Database::getConnection(static::TEST_TARGET_CONNECTION)->query($this->getQuery()['connection_id'])->fetchField(); diff --git a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php index 1c2944a18ed7..286995f04498 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php @@ -146,6 +146,7 @@ public function testExceptionResponseGeneratedForOriginalRequest(): void { * The path to test. * * @return \Drupal\Core\Render\HtmlResponse + * The generated 404 response. * * @see \Drupal\system\Tests\Routing\ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest() */ diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php index 3ef3ec815dd4..df7204d5f74b 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php @@ -453,6 +453,7 @@ public function testThemeInfoAlter(): void { * Returns the theme handler service. * * @return \Drupal\Core\Extension\ThemeHandlerInterface + * The theme handler service. */ protected function themeHandler() { return $this->container->get('theme_handler'); @@ -462,6 +463,7 @@ protected function themeHandler() { * Returns the theme installer service. * * @return \Drupal\Core\Extension\ThemeInstallerInterface + * The theme installer service. */ protected function themeInstaller() { return $this->container->get('theme_installer'); @@ -471,6 +473,7 @@ protected function themeInstaller() { * Returns the system.theme config object. * * @return \Drupal\Core\Config\Config + * The system.theme config object. */ protected function extensionConfig() { return $this->config('core.extension'); @@ -480,6 +483,7 @@ protected function extensionConfig() { * Returns the ModuleHandler. * * @return \Drupal\Core\Extension\ModuleHandlerInterface + * The ModuleHandler. */ protected function moduleHandler(): ?object { return $this->container->get('module_handler'); @@ -489,6 +493,7 @@ protected function moduleHandler(): ?object { * Returns the ModuleInstaller. * * @return \Drupal\Core\Extension\ModuleInstallerInterface + * The ModuleInstaller. */ protected function moduleInstaller(): ?object { return $this->container->get('module_installer'); @@ -498,6 +503,7 @@ protected function moduleInstaller(): ?object { * Returns the ThemeExtensionList. * * @return \Drupal\Core\Extension\ThemeExtensionList + * The ThemeExtensionList. */ protected function extensionListTheme(): ThemeExtensionList { return $this->container->get('extension.list.theme'); diff --git a/core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php b/core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php index a604a1583c94..47680a362a0f 100644 --- a/core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php +++ b/core/tests/Drupal/TestTools/Extension/InfoWriterTrait.php @@ -23,6 +23,7 @@ trait InfoWriterTrait { * The info array. * * @return void + * No return value. */ private function writeInfoFile(string $file_path, array $info): void { $mtime = file_exists($file_path) ? filemtime($file_path) : FALSE; diff --git a/core/tests/Drupal/Tests/ComposerIntegrationTest.php b/core/tests/Drupal/Tests/ComposerIntegrationTest.php index 69e3517e7753..f3634f8ee382 100644 --- a/core/tests/Drupal/Tests/ComposerIntegrationTest.php +++ b/core/tests/Drupal/Tests/ComposerIntegrationTest.php @@ -77,6 +77,7 @@ public function testComposerTilde(string $path): void { * Data provider for all the composer.json provided by Drupal core. * * @return array + * An array of composer.json file paths. */ public static function providerTestComposerJson(): array { $data = []; @@ -134,6 +135,7 @@ public function testAllCoreComponentsReplaced(): void { * Data provider for the scaffold files test for Drupal core. * * @return array + * An array of scaffold file mappings. */ public static function providerTestExpectedScaffoldFiles() { return [ diff --git a/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php b/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php index 5065b543e9f9..3f607877c66f 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php @@ -51,6 +51,7 @@ public function testRender($position): void { * The data provider for potential dialog positions. * * @return array + * An array of dialog positions. */ public static function dialogPosition() { return [ diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php index dc005bc3f092..2290e76f492c 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php @@ -20,6 +20,7 @@ class CacheTest extends UnitTestCase { * Provides a list of cache tags arrays. * * @return array + * An array of cache tags arrays. */ public function validateTagsProvider() { return [ @@ -49,6 +50,7 @@ public function validateTagsProvider() { * Provides a list of pairs of cache tags arrays to be merged. * * @return array + * An array of pairs of cache tags arrays to be merged. */ public static function mergeTagsProvider() { return [ @@ -76,6 +78,7 @@ public function testMergeTags(array $expected, ...$cache_tags): void { * Provides a list of pairs of cache tags arrays to be merged. * * @return array + * An array of pairs of cache tags arrays to be merged. */ public static function mergeMaxAgesProvider() { return [ @@ -115,6 +118,7 @@ public function testMergeMaxAges($expected, ...$max_ages): void { * Provides a list of pairs of cache contexts arrays to be merged. * * @return array + * An array of pairs of cache contexts arrays to be merged. */ public static function mergeCacheContextsProvide() { return [ @@ -154,6 +158,7 @@ public function testMergeCacheContexts(array $expected, ...$contexts): void { * Provides a list of pairs of (prefix, suffixes) to build cache tags from. * * @return array + * An array of pairs of (prefix, suffixes) to build cache tags from. */ public static function buildTagsProvider() { return [ diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php index 9162ecf21cd5..a4119bab9d1f 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php @@ -71,6 +71,7 @@ public function testAddCacheableDependency(CacheableMetadata $a, CacheableMetada * Provides test data for testMerge(). * * @return array + * An array of test cases, each containing two CacheableMetadata objects and their expected merged result. */ public static function providerTestMerge() { return [ @@ -150,6 +151,7 @@ public function testCreateFromRenderArray(array $render_array, CacheableMetadata * Provides test data for createFromRenderArray(). * * @return array + * An array of test cases, each containing a render array and the expected CacheableMetadata object. */ public static function providerTestCreateFromRenderArray() { $data = []; @@ -186,6 +188,7 @@ public function testCreateFromObject($object, CacheableMetadata $expected): void * Provides test data for createFromObject(). * * @return array + * An array of test cases, each containing an object and the expected CacheableMetadata. */ public static function providerTestCreateFromObject() { $data = []; diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php index 042c27490440..f76e8cd64743 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php @@ -199,6 +199,7 @@ protected function getMockContainer() { * Provides a list of cache context token arrays. * * @return array + * An array of cache context token arrays. */ public static function validateTokensProvider() { return [ diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php index 5d4084b5b605..2f80da322072 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/IsFrontPathCacheContextTest.php @@ -38,6 +38,7 @@ public function testGetContextNotFront(): void { * Whether the page is the front page. * * @return \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Path\PathMatcherInterface> + * The path matcher prophecy. */ protected function createPathMatcher($is_front): ObjectProphecy { $path_matcher = $this->prophesize(PathMatcherInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php index 03f1059d1826..840dbc6a4383 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php @@ -288,6 +288,7 @@ public function testCalculateDependenciesWithPluginCollections(array $definition * Data provider for testCalculateDependenciesWithPluginCollections. * * @return array + * An array of test cases, each containing a plugin definition and expected dependencies. */ public static function providerCalculateDependenciesWithPluginCollections(): array { // Start with 'a' so that order of the dependency array is fixed. diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index 0330e1b60b2a..2b4d2990d52e 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -198,6 +198,7 @@ public function testCreateWithPredefinedUuid(): void { * @covers ::doCreate * * @return \Drupal\Core\Entity\EntityInterface + * The created entity with ID, language code, and UUID set. */ public function testCreate() { $this->cacheTagsInvalidator->invalidateTags(Argument::cetera())->shouldNotBeCalled(); @@ -253,6 +254,7 @@ public function testCreateWithExplicitLanguage(): void { * The entity to test. * * @return \Drupal\Core\Entity\EntityInterface + * The saved entity after insertion. * * @depends testCreate */ @@ -306,6 +308,7 @@ public function testSaveInsert(EntityInterface $entity) { * The entity to test. * * @return \Drupal\Core\Entity\EntityInterface + * The saved entity after update. * * @depends testSaveInsert */ @@ -696,6 +699,7 @@ public function testDeleteNothing(): void { * (optional) The methods to mock. * * @return \Drupal\Core\Config\Entity\ConfigEntityInterface&\PHPUnit\Framework\MockObject\MockObject + * A mocked configuration entity instance. */ public function getMockEntity(array $values = [], array $methods = []): ConfigEntityInterface&MockObject { return $this->getMockBuilder(StubConfigEntity::class) diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php index b3b29d0d5172..871af06c0097 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php @@ -42,6 +42,7 @@ protected function setUp(): void { * An array of values to use for the ConfigEntityType. * * @return \Drupal\Core\Config\Entity\ConfigEntityTypeInterface + * The ConfigEntityType object. */ protected function setUpConfigEntityType($definition) { if (!isset($definition['id'])) { diff --git a/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php b/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php index 8a64287ea0fd..730679436923 100644 --- a/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php @@ -85,6 +85,7 @@ public static function providerTestReplaceStorageContents() { * The config storage to extract the data from. * * @return array + * The config data as an array. */ protected static function toArray(MemoryStorage $storage) { $reflection = new \ReflectionObject($storage); diff --git a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php index 7ef2e4fd4fc0..8cdfffbac14a 100644 --- a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php @@ -113,6 +113,7 @@ public function testCompileWithKnownOperators($expected, $field, $value, $operat * Provides a list of known operations and the expected output. * * @return array + * An array of known operations and the expected output. */ public static function dataProviderTestCompileWithKnownOperators() { // Below are a list of commented out test cases, which should work but diff --git a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php index 411bec228eaf..7ecc4518d714 100644 --- a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php +++ b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php @@ -23,6 +23,7 @@ class RowCountExceptionTest extends UnitTestCase { * Data provider for ::testExceptionMessage() * * @return array + * An array of test data for ::testExceptionMessage(). */ public static function providerTestExceptionMessage() { return [ diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php index 0d8727710d36..577c25c3ff9e 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php @@ -104,6 +104,7 @@ public function testProcess(): void { * The service definition. * * @return \Symfony\Component\DependencyInjection\ContainerBuilder + * The container with a sqlite database service in it. */ protected function getSqliteContainer($service) { $container = new ContainerBuilder(); @@ -124,6 +125,7 @@ protected function getSqliteContainer($service) { * The service definition. * * @return \Symfony\Component\DependencyInjection\ContainerBuilder + * The container with a mysql database service in it. */ protected function getMysqlContainer($service) { $container = new ContainerBuilder(); @@ -142,6 +144,7 @@ protected function getMysqlContainer($service) { * The service definition. * * @return \Symfony\Component\DependencyInjection\ContainerBuilder + * The container with a DriverTestMysql database service in it. */ protected function getDriverTestMysqlContainer($service) { $container = new ContainerBuilder(); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php index 9f9e743050be..f8222587a007 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/StackedKernelPassTest.php @@ -155,6 +155,7 @@ public function testProcessWithStackedKernelAndFinalHttpMiddleware(): void { * The priority to be used for the tag. * * @return \Symfony\Component\DependencyInjection\Definition + * The middleware definition. */ protected function createMiddlewareServiceDefinition($tag = TRUE, $priority = 0) { $definition = new Definition('Symfony\Component\HttpKernel\HttpKernelInterface', ['test']); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php index f2868d22ab7f..dcfcd82b0370 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php @@ -46,6 +46,7 @@ protected function setUp(): void { * Provides test data for testAccess. * * @return array + * An array of test data for testAccess. */ public static function providerTestAccess() { $no_access = FALSE; diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php index c1217a722626..d810500b1a0e 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @@ -24,6 +24,7 @@ class EntityTypeTest extends UnitTestCase { * An array of values to use for the EntityType. * * @return \Drupal\Core\Entity\EntityTypeInterface + * The EntityType object. */ protected function setUpEntityType($definition) { $definition += [ diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php index 41603ca4a6cc..79d46b05ac4b 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php @@ -472,6 +472,7 @@ public function testUriRelationships(): void { * The getEntityType() and entityTypeBundleInfo() methods are always mocked. * * @return \Drupal\Tests\Core\Entity\StubEntityBase&\PHPUnit\Framework\MockObject\MockObject + * A mock entity object with predefined methods and properties for testing. */ protected function getEntity(string $class, array $values, array $methods = []): StubEntityBase&MockObject { $methods = array_merge($methods, ['getEntityType', 'entityTypeBundleInfo']); diff --git a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php index 0ba944f287c6..30e5d0917eb1 100644 --- a/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php @@ -368,6 +368,7 @@ public static function factoryTypeProvider() { * The factory name to use. * * @return \Drupal\Core\Field\FieldDefinition + * A field definition instance created using the specified factory. */ protected function initializeFieldUsingFactory($factory_name) { switch ($factory_name) { diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index e82cd6885cbc..7b17519f4108 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -208,6 +208,7 @@ public function testCreateWithoutUuidKey(): void { * @covers ::doCreate * * @return \Drupal\Core\Entity\EntityInterface + * The newly created entity instance with the specified ID and generated UUID. */ public function testCreate() { $entity = $this->getMockEntity(EntityBaseTest::class, [], ['toArray']); @@ -241,6 +242,7 @@ public function testCreate() { * The entity. * * @return \Drupal\Core\Entity\EntityInterface + * The saved entity instance after insertion. * * @depends testCreate */ @@ -284,6 +286,7 @@ public function testSaveInsert(EntityInterface $entity) { * The entity. * * @return \Drupal\Core\Entity\EntityInterface + * The updated entity instance after saving. * * @depends testSaveInsert */ @@ -616,6 +619,7 @@ public function testDeleteNothing(): void { * (optional) The methods to mock. * * @return \Drupal\Core\Entity\EntityInterface&\PHPUnit\Framework\MockObject\MockObject + * A mock entity instance with the specified methods mocked. */ protected function getMockEntity(string $class = EntityBaseTest::class, array $arguments = [], array $methods = []): EntityInterface&MockObject { // Ensure the entity is passed at least an array of values and an entity diff --git a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php index 82593d4aa6b2..23e879bb89f3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php @@ -383,6 +383,7 @@ public function testGetEntityTypeIdKeyTypeNotFieldable(): void { * (optional) The prophesize base entity type. * * @return \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Entity\EntityTypeInterface> + * The entity type prophecy. */ protected static function getEntityType(?ObjectProphecy $base_entity_type = NULL): ObjectProphecy { $entity_type = (new Prophet())->prophesize(EntityTypeInterface::class); diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php index 4d468847ac8e..2122d852c83d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php @@ -588,6 +588,7 @@ public static function providerTestGetDedicatedTableName() { * field. * * @return \Drupal\Core\Field\FieldStorageDefinitionInterface|\PHPUnit\Framework\MockObject\MockObject + * A mock field storage definition with configured field properties. */ protected function setUpDefinition($name, array $column_names, $base_field = TRUE) { $definition = $this->createMock('Drupal\Tests\Core\Field\TestBaseFieldDefinitionInterface'); diff --git a/core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php b/core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php index 8047c1412c13..21157cdf1a05 100644 --- a/core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php +++ b/core/tests/Drupal/Tests/Core/GroupIncludesTestTrait.php @@ -16,6 +16,7 @@ trait GroupIncludesTestTrait { /** * @return array[] + * An array of module filenames mapped to their virtual file system paths. */ public static function setupGroupIncludes(): array { vfsStream::setup('drupal_root'); diff --git a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php index 527258fc75b1..329feea31ed1 100644 --- a/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php +++ b/core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php @@ -63,6 +63,7 @@ public function testCreateFromOptions($settings_config, $parameter_config, $expe * Data provider for testCreateFromOptions. * * @return array + * An array of test data for testCreateFromOptions. */ public static function providerTestCreateFromOptions() { return [ diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 2307b355e7ba..9089408e9062 100644 --- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -68,6 +68,7 @@ public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, Bubbleabl * Provides test data for testMerge(). * * @return array + * An array of test data for testMerge(). */ public static function providerTestMerge() { return [ @@ -143,6 +144,7 @@ public function testApplyTo(BubbleableMetadata $metadata, array $render_array, a * Provides test data for testApplyTo(). * * @return array + * An array of test data for testApplyTo(). */ public static function providerTestApplyTo() { $data = []; @@ -207,6 +209,7 @@ public function testCreateFromRenderArray(array $render_array, BubbleableMetadat * Provides test data for createFromRenderArray(). * * @return array + * An array of test data for createFromRenderArray(). */ public static function providerTestCreateFromRenderArray() { $data = []; @@ -401,6 +404,7 @@ public function testMergeAttachmentsHtmlHeadMerging($a, $b, $expected): void { * Data provider for testMergeAttachmentsHtmlHeadMerging. * * @return array + * An array of test data for testMergeAttachmentsHtmlHeadMerging. */ public static function providerTestMergeAttachmentsHtmlHeadMerging() { $meta = [ @@ -474,6 +478,7 @@ public function testMergeAttachmentsHtmlHeadLinkMerging($a, $b, $expected): void * Data provider for testMergeAttachmentsHtmlHeadLinkMerging. * * @return array + * An array of test data for testMergeAttachmentsHtmlHeadLinkMerging. */ public static function providerTestMergeAttachmentsHtmlHeadLinkMerging() { $rel = [ @@ -540,6 +545,7 @@ public function testMergeAttachmentsHttpHeaderMerging($a, $b, $expected): void { * Data provider for testMergeAttachmentsHttpHeaderMerging. * * @return array + * An array of test data for testMergeAttachmentsHttpHeaderMerging. */ public static function providerTestMergeAttachmentsHttpHeaderMerging() { $content_type = [ @@ -614,6 +620,7 @@ public function testAddCacheableDependency(BubbleableMetadata $a, $b, Bubbleable * Provides test data for testMerge(). * * @return array + * An array of test data for testMerge(). */ public function providerTestAddCacheableDependency() { return [ diff --git a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php index a9ede9f13c8e..abd1cc4ead37 100644 --- a/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php @@ -113,6 +113,7 @@ public function testGetInfoElementPlugin($plugin_class, $expected_info): void { * Provides tests data for testGetInfoElementPlugin(). * * @return array + * An array of test data for testGetInfoElementPlugin(). */ public static function providerTestGetInfoElementPlugin() { $data = []; diff --git a/core/tests/Drupal/Tests/Core/Render/ElementTest.php b/core/tests/Drupal/Tests/Core/Render/ElementTest.php index fd71a85a59dc..e511d6af3f7c 100644 --- a/core/tests/Drupal/Tests/Core/Render/ElementTest.php +++ b/core/tests/Drupal/Tests/Core/Render/ElementTest.php @@ -141,6 +141,7 @@ public function testVisibleChildren(array $element, array $expected_keys): void * Data provider for testVisibleChildren. * * @return array + * An array of test cases. */ public static function providerVisibleChildren() { return [ diff --git a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php index 34e2f44b88d4..f1344b0ce8e2 100644 --- a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php @@ -34,6 +34,7 @@ public function testProcessPlaceholders($strategies, $placeholders, $result): vo * Provides a list of render strategies, placeholders and results. * * @return array + * An array of render strategies, placeholders and results. */ public static function providerProcessPlaceholders() { $prophet = new Prophet(); diff --git a/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php index 065cdc6d15a2..21e9e7011d35 100644 --- a/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php @@ -86,6 +86,7 @@ public function testRenderPlaceholdersDifferentSortedContextsTags(): void { /** * @return array + * An array of test cases with different placeholder inputs. */ public static function providerCreatePlaceholderGeneratesValidHtmlMarkup() { return [ diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php index 52944069309c..2a6f20bb6cd9 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php @@ -500,6 +500,7 @@ public function testBubblingWithPrerender($test_element): void { * Provides two test elements: one without, and one with the theme system. * * @return array + * An array of test cases, each containing a render array with different configurations. */ public static function providerTestBubblingWithPrerender() { $data = []; diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php index 3f05b89465ce..14aafbc8adab 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php @@ -62,6 +62,7 @@ protected function setUp(): void { * https://www.drupal.org/node/2559847 * * @return array + * An array of test cases. */ public static function providerPlaceholders(): array { $args = [static::randomContextValue()]; @@ -1150,6 +1151,7 @@ protected function generatePlaceholdersWithChildrenTestElement(array $args_1, ar /** * @return \Drupal\Core\Theme\ThemeManagerInterface|\PHPUnit\Framework\MockObject\Builder\InvocationMocker + * The mocked theme manager. */ protected function setupThemeManagerForDetails() { return $this->themeManager->expects($this->any()) diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index b08e2910c092..e9a27fd6cd65 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -69,6 +69,7 @@ public function testRenderBasic($build, $expected, ?callable $setup_code = NULL) * Provides a list of render arrays to test basic rendering. * * @return array + * An array of render arrays and their expected output. */ public static function providerTestRenderBasic(): array { $data = []; @@ -672,6 +673,7 @@ public function testRenderTwice($build): void { * Provides a list of render array iterations. * * @return array + * An array of render arrays. */ public static function providerRenderTwice() { return [ @@ -726,6 +728,7 @@ public function testRenderChildrenAccess(): void { * Provides a list of both booleans. * * @return array + * A list of boolean values and AccessResult objects. */ public static function providerAccessValues() { return [ @@ -801,6 +804,7 @@ public function testRenderWithThemeArguments(): void { * Provides a list of access conditions and expected cache metadata. * * @return array + * An array of access conditions and expected cache metadata. */ public static function providerRenderCache() { return [ diff --git a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php index 0ac65036e28c..a786ffe8abd9 100644 --- a/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php +++ b/core/tests/Drupal/Tests/Core/Security/RequestSanitizerTest.php @@ -106,6 +106,7 @@ public function testRequestSanitization(Request $request, array $expected = [], * Data provider for testRequestSanitization. * * @return array + * An array of test data for testRequestSanitization. */ public static function providerTestRequestSanitization() { $tests = []; diff --git a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php index 75e0e4f90bf9..d7fa634a8ac3 100644 --- a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php @@ -367,6 +367,7 @@ public function testCacheContextCaching(): void { * Sets up the access policy processor. * * @return \Drupal\Core\Session\AccessPolicyProcessorInterface + * The access policy processor. */ protected function setUpAccessPolicyProcessor( ?VariationCacheInterface $variation_cache = NULL, diff --git a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php index a68788cc4773..b0460940a057 100644 --- a/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php +++ b/core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php @@ -17,6 +17,7 @@ class SessionConfigurationTest extends UnitTestCase { * Constructs a partially mocked SUT. * * @return \Drupal\Core\Session\SessionConfiguration|\PHPUnit\Framework\MockObject\MockObject + * A mock object of SessionConfiguration with specific methods overridden. */ protected function createSessionConfiguration($options = []) { return $this->getMockBuilder('Drupal\Core\Session\SessionConfiguration') diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php index 68c9e56f7c9d..b57d4ac16c8a 100644 --- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php +++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php @@ -100,6 +100,7 @@ public function testGetHashSaltEmpty(array $config): void { * Data provider for testGetHashSaltEmpty. * * @return array + * An array of settings arrays with no hash salt value. */ public static function providerTestGetHashSaltEmpty() { return [ diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php index 51b3082d944f..774d183acd53 100644 --- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php @@ -34,6 +34,7 @@ protected function setUp(): void { * Provides some test data for formatPlural() * * @return array + * An array of test data for formatPlural(). */ public static function providerTestFormatPlural() { return [ @@ -88,6 +89,7 @@ public function testTranslatePlaceholder($string, array $args, $expected_string) * Provides test data for translate(). * * @return array + * An array of test data for translate(). */ public static function providerTestTranslatePlaceholder() { return [ diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php index 158c8749239c..8862dc563d48 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php @@ -448,6 +448,7 @@ public function testTwigAddSuggestionFilter($original_render_array, $suggestion, * Provides data for ::testTwigAddSuggestionFilter(). * * @return \Iterator + * An iterator of test data. */ public static function providerTestTwigAddSuggestionFilter(): \Iterator { yield 'suggestion should be added' => [ @@ -564,6 +565,7 @@ public function testTwigAddClass($element, $classes, $expected_result): void { * Provides data for ::testTwigAddClass(). * * @return \Iterator + * An iterator of test data for ::testTwigAddClass(). */ public static function providerTestTwigAddClass(): \Iterator { yield 'should add a class on element' => [ @@ -614,6 +616,7 @@ public function testTwigSetAttribute($element, $key, $value, $expected_result): * A data provider for ::testTwigSetAttribute(). * * @return \Iterator + * An iterator of test data for ::testTwigSetAttribute(). */ public static function providerTestTwigSetAttribute(): \Iterator { yield 'should add attributes on element' => [ diff --git a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php index 4fdeae02e12b..ab15d8a2b17f 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php @@ -57,6 +57,7 @@ public function testEntityDangerousMethods($template): void { * Data provider for ::testEntityDangerousMethods. * * @return array + * An array of dangerous methods. */ public static function getTwigEntityDangerousMethods() { return [ diff --git a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php index 088e70325f47..3d2b2ae641ab 100644 --- a/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php +++ b/core/tests/Drupal/Tests/Core/Transliteration/PhpTransliterationTest.php @@ -62,6 +62,7 @@ public function testPhpTransliterationWithAlter($langcode, $original, $expected, * Provides test data for testPhpTransliterationWithAlter. * * @return array + * An array of test data for testPhpTransliterationWithAlter. */ public static function providerTestPhpTransliterationWithAlter() { $random_generator = new Random(); diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index 09e54efb1c18..84977e722c7f 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -799,6 +799,7 @@ public function testFromRouteUriWithMissingRouteName(): void { * The account to test. * * @return \Drupal\Core\Access\AccessManagerInterface|\PHPUnit\Framework\MockObject\MockObject + * The mocked access manager. */ protected function getMockAccessManager($access, $account = NULL) { $access_manager = $this->createMock('Drupal\Core\Access\AccessManagerInterface'); diff --git a/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php b/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php index 9d6c740675b4..2a85573fefd1 100644 --- a/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/ErrorTest.php @@ -80,6 +80,7 @@ public function testFormatBacktrace(array $backtrace, string $expected): void { * Data provider for testFormatBacktrace. * * @return array + * An array of test cases, each containing a backtrace array and its expected formatted string. */ public static function providerTestFormatBacktrace(): array { $data = []; diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php index b8ba4752fb4d..3867617e45d0 100644 --- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php @@ -121,6 +121,7 @@ public function testAssembleWithLocalUri($uri, array $options, $subdir, $expecte /** * @return array + * An array of test data for testAssembleWithLocalUri. */ public static function providerTestAssembleWithLocalUri() { return [ diff --git a/core/tests/Drupal/Tests/TestFileCreationTrait.php b/core/tests/Drupal/Tests/TestFileCreationTrait.php index 43357296dede..9030ff7c23bf 100644 --- a/core/tests/Drupal/Tests/TestFileCreationTrait.php +++ b/core/tests/Drupal/Tests/TestFileCreationTrait.php @@ -112,6 +112,7 @@ protected function getTestFiles($type, $size = NULL) { * The second class. * * @return int + * -1 if $file1 is smaller than $file2, 0 if they are the same size, and 1 */ protected function compareFiles($file1, $file2): int { $compare_size = filesize($file1->uri) - filesize($file2->uri); -- GitLab