From f9649bc7826b2de59edb10b6983afd756d047d27 Mon Sep 17 00:00:00 2001 From: nod_ <nod_@598310.no-reply.drupal.org> Date: Thu, 23 Jan 2025 15:45:12 +0100 Subject: [PATCH] Issue #3477671 by quietone: Fix VariableComment.Missing in core/tests --- core/phpcs.xml.dist | 2 +- .../DefaultContent/ContentImportTest.php | 3 +++ .../InstallerExistingConfigNoConfigTest.php | 3 +++ ...erExistingConfigProfileHookInstallTest.php | 3 +++ .../Core/Action/DeleteActionTest.php | 3 +++ .../Core/Plugin/PluginTestBase.php | 23 +++++++++++++++++++ .../Recipe/EntityMethodConfigActionsTest.php | 3 +++ .../KernelTests/Core/Recipe/InputTest.php | 3 +++ .../KernelTests/Core/Theme/RegistryTest.php | 3 +++ .../Tests/Component/Annotation/PluginTest.php | 4 ++++ .../Plugin/Scaffold/ScaffoldTestResult.php | 7 ++++++ .../Asset/LibraryDiscoveryCollectorTest.php | 3 +++ .../Core/Asset/LibraryDiscoveryParserTest.php | 3 +++ .../Drupal/Tests/Core/Common/TagsTest.php | 3 +++ .../Entity/ConfigEntityBaseUnitTest.php | 9 ++++++++ .../Controller/ControllerResolverTest.php | 4 ++++ .../KeyValueEntityStorageTest.php | 23 +++++++++++++++++++ .../Tests/Core/Entity/StubEntityBase.php | 16 +++++++++++++ .../Core/Form/ConfigFormBaseTraitTest.php | 4 ++++ .../Tests/Core/Logger/LoggerChannelTest.php | 7 ++++++ .../Drupal/Tests/Core/Menu/MenuLinkMock.php | 3 +++ .../Plugin/FilteredPluginManagerTraitTest.php | 12 ++++++++++ .../Core/Plugin/PluginDependencyTraitTest.php | 6 +++++ .../Drupal/Tests/Core/Render/RendererTest.php | 3 +++ .../Core/Render/TestCacheableDependency.php | 11 +++++++++ .../Session/AccessPolicyProcessorTest.php | 3 +++ .../Tests/Core/Template/TwigExtensionTest.php | 3 +++ .../Core/Utility/CallableResolverTest.php | 3 +++ core/tests/Drupal/Tests/StreamCapturer.php | 3 +++ 29 files changed, 175 insertions(+), 1 deletion(-) diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 5cd466001454..47d0a73e4a30 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -110,7 +110,7 @@ <exclude name="Drupal.Commenting.VariableComment.MissingVar"/> </rule> <rule ref="Drupal.Commenting.VariableComment.Missing"> - <exclude-pattern>./core/tests/*</exclude-pattern> + <include-pattern>./core/tests/*</include-pattern> <exclude-pattern>./core/*/tests/*</exclude-pattern> <include-pattern>core/modules/*/tests/modules/*</include-pattern> </rule> diff --git a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php index e43c7797e22c..8a3078733c50 100644 --- a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php +++ b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php @@ -72,6 +72,9 @@ class ContentImportTest extends BrowserTestBase { 'user', ]; + /** + * The directory with the source data. + */ private readonly string $contentDir; /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php index 22be7c48e392..4461c06b2106 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php @@ -16,6 +16,9 @@ class InstallerExistingConfigNoConfigTest extends InstallerConfigDirectoryTestBa */ protected $defaultTheme = 'stark'; + /** + * {@inheritdoc} + */ protected $profile = 'no_config_profile'; /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php index 98933d069275..692a9af87302 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php @@ -11,6 +11,9 @@ */ class InstallerExistingConfigProfileHookInstallTest extends InstallerConfigDirectoryTestBase { + /** + * {@inheritdoc} + */ protected $profile = 'config_profile_with_hook_install'; /** diff --git a/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php b/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php index 9ce189b5df14..35cda2bb5c04 100644 --- a/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Action/DeleteActionTest.php @@ -15,6 +15,9 @@ */ class DeleteActionTest extends KernelTestBase { + /** + * The test user. + */ protected $testUser; /** diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php index 21e5ead9079b..a6f8dda1ca0d 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php @@ -22,11 +22,34 @@ abstract class PluginTestBase extends KernelTestBase { */ protected static $modules = ['plugin_test']; + /** + * The test plugin manager used by Plugin API unit tests. + */ protected $testPluginManager; + + /** + * The expected plugin definitions for the test plugin. + */ protected $testPluginExpectedDefinitions; + + /** + * The mock plugin manager used by Plugin API derivative unit tests. + */ protected $mockBlockManager; + + /** + * The expected plugin definitions for the mock block plugin. + */ protected $mockBlockExpectedDefinitions; + + /** + * The default plugin manager used by Plugin API unit tests. + */ protected $defaultsTestPluginManager; + + /** + * The expected plugin definitions for the defaults plugin. + */ protected $defaultsTestPluginExpectedDefinitions; /** diff --git a/core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php b/core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php index 4b68ee2855c5..8c08c3b8c848 100644 --- a/core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php @@ -20,6 +20,9 @@ class EntityMethodConfigActionsTest extends KernelTestBase { */ protected static $modules = ['config_test', 'entity_test', 'system']; + /** + * The configuration action manager. + */ private readonly ConfigActionManager $configActionManager; /** diff --git a/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php b/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php index cd3f14644e9e..ad120109c634 100644 --- a/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php +++ b/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php @@ -33,6 +33,9 @@ class InputTest extends KernelTestBase { */ protected static $modules = ['system', 'user']; + /** + * The recipe. + */ private readonly Recipe $recipe; /** diff --git a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php index 1cdca5c5dc09..469f128f09ee 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php @@ -24,6 +24,9 @@ class RegistryTest extends KernelTestBase { */ protected static $modules = ['theme_test', 'system']; + /** + * The profile to use for this test. + */ protected $profile = 'testing'; /** diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php index a2b6ce7086da..dd2db0b7253c 100644 --- a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php +++ b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php @@ -97,6 +97,10 @@ public function testSetClass(): void { * {@inheritdoc} */ class PluginStub extends Plugin { + + /** + * A default property for testing. + */ protected $defaultProperty = 'test_value'; } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php index 668665400b22..f44c12ce1d94 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ScaffoldTestResult.php @@ -9,7 +9,14 @@ */ class ScaffoldTestResult { + /** + * The location of the scaffold fixture. + */ protected $docroot; + + /** + * The stdout from the test. + */ protected $scaffoldOutput; /** diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php index cecf44fc3b4e..7d1566d9ff92 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php @@ -83,6 +83,9 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { ], ]; + /** + * The active theme. + */ protected $activeTheme; /** diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index e731afbc6120..991f7d389daf 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -869,6 +869,9 @@ public function testEmptyLibraryFile(): void { */ class TestLibraryDiscoveryParser extends LibraryDiscoveryParser { + /** + * The valid URIs. + */ protected $validUris; protected function fileValidUri($source) { diff --git a/core/tests/Drupal/Tests/Core/Common/TagsTest.php b/core/tests/Drupal/Tests/Core/Common/TagsTest.php index d4fc3a936e2a..11f1dc17616e 100644 --- a/core/tests/Drupal/Tests/Core/Common/TagsTest.php +++ b/core/tests/Drupal/Tests/Core/Common/TagsTest.php @@ -16,6 +16,9 @@ */ class TagsTest extends UnitTestCase { + /** + * A list of valid tags. + */ protected $validTags = [ 'Drupal' => 'Drupal', 'Drupal with some spaces' => 'Drupal with some spaces', diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php index 0f9a7e16babf..ccb5f6138dd8 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php @@ -717,10 +717,19 @@ public static function providerTestSetAndPreSaveWithPluginCollections(): array { class TestConfigEntityWithPluginCollections extends ConfigEntityBaseWithPluginCollections { + /** + * The plugin collection. + */ protected $pluginCollection; + /** + * The plugin manager. + */ protected $pluginManager; + /** + * The configuration for the plugin collection. + */ protected array $the_plugin_collection_config = []; public function setPluginManager(PluginManagerInterface $plugin_manager): void { diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php index 4634e966fe98..a89e2a6f73a5 100644 --- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php @@ -205,6 +205,10 @@ public function getControllerWithRequestAndRouteMatch(RouteMatchInterface $route } class MockContainerInjection implements ContainerInjectionInterface { + + /** + * The test value saved during construction. + */ protected $result; public function __construct($result) { diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index 3022a966f46e..74fa24982734 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -61,6 +61,8 @@ class KeyValueEntityStorageTest extends UnitTestCase { protected $languageManager; /** + * The entity storage. + * * @var \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage */ protected $entityStorage; @@ -633,11 +635,32 @@ protected function getMockEntity(string $class = EntityBaseTest::class, array $a } class EntityBaseTest extends EntityBase { + + /** + * The entity ID. + */ public $id; + + /** + * The language code for the entity. + */ public $langcode; + + /** + * The entity UUID. + */ public $uuid; + + /** + * The entity label. + */ public $label; + /** + * The original, or NULL if the entity cannot be loaded. + */ + public $original; + } namespace Drupal\Core\Entity\KeyValueStore; diff --git a/core/tests/Drupal/Tests/Core/Entity/StubEntityBase.php b/core/tests/Drupal/Tests/Core/Entity/StubEntityBase.php index 4b7e547920f5..dce32a895865 100644 --- a/core/tests/Drupal/Tests/Core/Entity/StubEntityBase.php +++ b/core/tests/Drupal/Tests/Core/Entity/StubEntityBase.php @@ -11,9 +11,25 @@ */ class StubEntityBase extends EntityBase { + /** + * The ID for the stub entity. + */ public $id; + + /** + * The language code for the stub entity. + */ + public $langcode; + + /** + * The UUID for the stub entity. + */ public $uuid; + + /** + * The label for the stub entity. + */ public $label; } diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php index 318127b121b4..292d9ff7991c 100644 --- a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php @@ -71,6 +71,10 @@ public function testConfigFactoryExceptionInvalidProperty(): void { class ConfiguredTrait { use ConfigFormBaseTrait; + + /** + * The configuration factory. + */ public $configFactory; protected function getEditableConfigNames() {} diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php index 718fa92f3ed6..31f2f417cbf9 100644 --- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php +++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @@ -188,7 +188,14 @@ function ($context) { class NaughtyRecursiveLogger implements LoggerInterface { use LoggerTrait; + /** + * The logger channel. + */ protected $channel; + + /** + * The message to log. + */ protected $message; public function __construct(LoggerChannel $channel) { diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php b/core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php index 82b38aa8f9a7..fa49a1f2001d 100644 --- a/core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php +++ b/core/tests/Drupal/Tests/Core/Menu/MenuLinkMock.php @@ -12,6 +12,9 @@ */ class MenuLinkMock extends MenuLinkBase { + /** + * The default configuration for the test menu link. + */ protected static $defaults = [ 'menu_name' => 'mock', 'route_name' => 'MUST BE PROVIDED', diff --git a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php index b7c4e927dc3d..df45f38aeed9 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php @@ -85,12 +85,24 @@ class TestFilteredPluginManager extends PluginManagerBase implements FilteredPlu use FilteredPluginManagerTrait; + /** + * An array of plugin definitions. + */ protected $definitions = []; + /** + * The module handler. + */ protected $moduleHandler; + /** + * The theme manager. + */ protected $themeManager; + /** + * The context handler. + */ protected $contextHandler; public function __construct(array $definitions, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, ContextHandlerInterface $context_handler) { diff --git a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php index 8008a80c9466..c881b25fbd53 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php @@ -177,8 +177,14 @@ class TestPluginDependency { getPluginDependencies as public; } + /** + * The module handler. + */ protected $moduleHandler; + /** + * The theme handler. + */ protected $themeHandler; public function setModuleHandler(ModuleHandlerInterface $module_handler): void { diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php index bdbc2fa87d98..8b1591598768 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php @@ -22,6 +22,9 @@ */ class RendererTest extends RendererTestBase { + /** + * The expected theme variables. + */ protected $defaultThemeVars = [ '#cache' => [ 'contexts' => [ diff --git a/core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php b/core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php index a73a83aef6df..8465899488a1 100644 --- a/core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php +++ b/core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php @@ -11,8 +11,19 @@ */ class TestCacheableDependency implements CacheableDependencyInterface { + /** + * The cache contexts. + */ protected array $contexts; + + /** + * The cache tags. + */ protected array $tags; + + /** + * The cache maximum age. + */ protected $maxAge; public function __construct(array $contexts, array $tags, $max_age) { diff --git a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php index 9f14175e85db..b42de0512345 100644 --- a/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php @@ -550,6 +550,9 @@ public function getPersistentCacheContexts(): array { class CacheItem { + /** + * The cache data. + */ public $data; public function __construct($data) { diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php index e89c0c12fc75..4167fa4a30ee 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php @@ -677,6 +677,9 @@ public static function providerTestTwigSetAttribute(): \Iterator { class TwigExtensionTestString { + /** + * The test string. + */ protected $string; public function __construct($string) { diff --git a/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php b/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php index 0a5b45102b42..bb340b609918 100644 --- a/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/CallableResolverTest.php @@ -213,6 +213,9 @@ public function __invoke($suffix) { class MockContainerInjection implements ContainerInjectionInterface { + /** + * The value to be injected. + */ protected $injected; public function __construct($result) { diff --git a/core/tests/Drupal/Tests/StreamCapturer.php b/core/tests/Drupal/Tests/StreamCapturer.php index 0f9c8caebc9b..86bfec396653 100644 --- a/core/tests/Drupal/Tests/StreamCapturer.php +++ b/core/tests/Drupal/Tests/StreamCapturer.php @@ -11,6 +11,9 @@ */ class StreamCapturer extends \php_user_filter { + /** + * The cache data. + */ public static $cache = ''; public function filter($in, $out, &$consumed, $closing): int { -- GitLab