diff --git a/core/modules/block/tests/src/Kernel/ConfigActionsTest.php b/core/modules/block/tests/src/Kernel/ConfigActionsTest.php index fd7fa6f34c92bff28baaeb629de8f1bcfad57bfa..cb41d78251315fa7bdf176eb35f043e7376ace07 100644 --- a/core/modules/block/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/block/tests/src/Kernel/ConfigActionsTest.php @@ -49,6 +49,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of entity method actions on a block. + */ public function testEntityMethodActions(): void { $block = $this->placeBlock('system_messages_block', ['theme' => 'olivero']); $this->assertSame('content', $block->getRegion()); @@ -80,6 +83,9 @@ public function testPlaceBlockActionOnlyWorksOnBlocks(string $action): void { $this->configActionManager->applyAction($action, 'user.role.anonymous', []); } + /** + * Verifies placeBlockInDefaultTheme action doesn't alter an existing block. + */ public function testPlaceBlockActionDoesNotChangeExistingBlock(): void { $extant_region = Block::load('olivero_powered')->getRegion(); $this->assertNotSame('content', $extant_region); @@ -139,11 +145,17 @@ public function testPlaceBlockInStaticRegion(string $action, string $expected_th $this->assertSame('content', $block->getRegion()); } + /** + * Tests placing a block in the default theme's region. + */ public function testPlaceBlockInDefaultRegion(): void { $this->config('system.theme')->set('default', 'umami')->save(); $this->testPlaceBlockInDynamicRegion('placeBlockInDefaultTheme', 'umami', 'content'); } + /** + * Tests placing a block at the first and last position in a region. + */ public function testPlaceBlockAtPosition(): void { // Ensure there's at least one block already in the region. $block = Block::create([ diff --git a/core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php b/core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php index 836751ef813396ad4e0f4ee7e6e2b88d6af5ebd2..012743e855ed8b44adeef8cf3db0a8bb6afa68d0 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php @@ -95,6 +95,9 @@ public function testAddItemToToolbar(string|array $action, array $expected_toolb } } + /** + * Tests that adding non-existent toolbar item to CKEditor triggers an error. + */ public function testAddNonExistentItem(): void { $recipe = $this->createRecipe([ 'name' => 'Add an invalid toolbar item', @@ -112,6 +115,9 @@ public function testAddNonExistentItem(): void { RecipeRunner::processRecipe($recipe); } + /** + * Tests that the `addItemToToolbar` config action requires CKEditor 5. + */ public function testActionRequiresCKEditor5(): void { $this->enableModules(['editor_test']); Editor::load('filter_test')?->setEditor('unicorn')->setSettings([])->save(); diff --git a/core/modules/ckeditor5/tests/src/Kernel/WildcardHtmlSupportTest.php b/core/modules/ckeditor5/tests/src/Kernel/WildcardHtmlSupportTest.php index e1d57ed910a2239a9cd5059b5ff0cd9b90d1450a..1373bc0a66657fa8d09f49e4ce966b05e87a1489 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/WildcardHtmlSupportTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/WildcardHtmlSupportTest.php @@ -101,6 +101,9 @@ function (ConstraintViolationInterface $v) { $this->assertEquals($expected_ghs_configuration, $ghs_configuration); } + /** + * Provides test cases for CKEditor 5 General HTML Support (GHS) configuration. + */ public static function providerGhsConfiguration(): array { return [ 'empty source editing' => [ diff --git a/core/modules/contact/tests/src/Kernel/ConfigActionsTest.php b/core/modules/contact/tests/src/Kernel/ConfigActionsTest.php index 31210efca43544f8ce1dc04970d84a3a18c79387..a01027f482a38bc53ef4dab4e6503df5b769a657 100644 --- a/core/modules/contact/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/contact/tests/src/Kernel/ConfigActionsTest.php @@ -34,6 +34,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of configuration actions on a contact form. + */ public function testConfigActions(): void { $form = ContactForm::load('personal'); $this->assertSame('Your message has been sent.', $form->getMessage()); diff --git a/core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php b/core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php index 069390e1dd8e017eb4d9aa6e2dca7fe8a85a9409..df0e76408350ff31804f4cd0d130b268f2dc3136 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php @@ -40,6 +40,9 @@ class AddModerationConfigActionTest extends KernelTestBase { 'user', ]; + /** + * Tests adding entity types and bundles to a workflow. + */ public function testAddEntityTypeAndBundle(): void { $this->installEntitySchema('node'); $this->installConfig('node'); @@ -58,6 +61,9 @@ public function testAddEntityTypeAndBundle(): void { $this->assertSame(['tags'], $plugin->getBundlesForEntityType('taxonomy_term')); } + /** + * Tests that the workflow must be of type Content Moderation. + */ public function testWorkflowMustBeContentModeration(): void { $this->enableModules(['workflows', 'workflow_type_test']); @@ -74,6 +80,9 @@ public function testWorkflowMustBeContentModeration(): void { RecipeRunner::processRecipe($recipe); } + /** + * Tests that the action only targets workflows. + */ public function testActionOnlyTargetsWorkflows(): void { $recipe = $this->createRecipe('user.role.anonymous'); $this->expectException(PluginNotFoundException::class); @@ -81,6 +90,9 @@ public function testActionOnlyTargetsWorkflows(): void { RecipeRunner::processRecipe($recipe); } + /** + * Tests that the derived config action definitions have correct admin labels. + */ public function testDeriverAdminLabel(): void { $this->enableModules(['workflows', 'content_moderation']); @@ -92,6 +104,9 @@ public function testDeriverAdminLabel(): void { $this->assertSame('Add moderation to all vocabularies', (string) $definitions['add_moderation:addTaxonomyVocabularies']['admin_label']); } + /** + * Creates a recipe configuration for adding entity types and bundles to a workflow. + */ private function createRecipe(string $config_name): Recipe { $recipe = <<<YAML name: 'Add entity types and bundles to workflow' diff --git a/core/modules/field/tests/src/Kernel/ConfigActionsTest.php b/core/modules/field/tests/src/Kernel/ConfigActionsTest.php index 15dc362a8be57b4a74790e636304b4228449b061..384dc1f9ffa6033d342f0a24a88532a8c1fcfb32 100644 --- a/core/modules/field/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/field/tests/src/Kernel/ConfigActionsTest.php @@ -41,6 +41,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of configuration actions on field settings. + */ public function testConfigActions(): void { $field_storage = FieldStorageConfig::create([ 'field_name' => 'test', diff --git a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php index 6b1af094365ffd4017d7b4fc0ab4225b5b178549..1d21ebd34b2a8bacbce5cb6ea7ca5e38e1ab00b3 100644 --- a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php +++ b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php @@ -372,6 +372,9 @@ public function testDeleteNoData(): void { } } + /** + * Tests that updating a field storage type is not allowed. + */ public function testUpdateFieldType(): void { $field_storage = FieldStorageConfig::create([ 'field_name' => 'field_type', diff --git a/core/modules/file/tests/src/Kernel/SaveTest.php b/core/modules/file/tests/src/Kernel/SaveTest.php index cd38137f977a969364b9476afc272d4170024f8f..674236bbd1a58aea91ab10f61b080108ff7c3737 100644 --- a/core/modules/file/tests/src/Kernel/SaveTest.php +++ b/core/modules/file/tests/src/Kernel/SaveTest.php @@ -17,6 +17,9 @@ class SaveTest extends FileManagedUnitTestBase { use UserCreationTrait; + /** + * Tests the saving process of file entities. + */ public function testFileSave(): void { $account = $this->createUser(); // Create a new file entity. diff --git a/core/modules/image/tests/src/Kernel/ConfigActionsTest.php b/core/modules/image/tests/src/Kernel/ConfigActionsTest.php index 1334d832f61ae6e4c322c7b838e3e91d88f9059a..dda3aa1acc55e6d65034a83b0ceee3a821acfb10 100644 --- a/core/modules/image/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/image/tests/src/Kernel/ConfigActionsTest.php @@ -32,6 +32,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests adding an image effect using the configuration action manager. + */ public function testConfigActions(): void { $style = ImageStyle::load('large'); $this->assertCount(2, $style->getEffects()); diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php index ced2507e1384a8ff9d788dd824c58ee75510fa40..38b7310972f9ef2b42057650f7a6611f31502ee5 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php @@ -909,6 +909,9 @@ public function testConfigEntityResourceObjectSchema(): void { $this->assertSame([], $validator->getErrors(), 'Validation errors on object ' . print_r($normalized, TRUE) . ' with schema ' . print_r($schema, TRUE)); } + /** + * Tests the serialization of a top-level JSON:API document with a single resource. + */ public function testTopLevelResourceWithSingleResource(): void { [, $resource_object] = $this->getTestContentEntityResource(); $serializer = $this->container->get('jsonapi.serializer'); diff --git a/core/modules/language/tests/src/Kernel/ConfigActionsTest.php b/core/modules/language/tests/src/Kernel/ConfigActionsTest.php index 0b159f7463865d91e4d37c3f0dc82f7d126f47f4..1a9474ed3ae123fd081b5733b0e72bbcce87be8b 100644 --- a/core/modules/language/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/language/tests/src/Kernel/ConfigActionsTest.php @@ -32,6 +32,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of configuration actions on a language. + */ public function testConfigActions(): void { $language = ConfigurableLanguage::load('en'); $this->assertSame('English', $language->getName()); diff --git a/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php b/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php index fd2d93945d199e8fc89ef48a3723d7e5d10bb097..2c890e222ce633ea225208bcbaefabd56995600d 100644 --- a/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php +++ b/core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php @@ -44,6 +44,9 @@ class InlineBlockUsageTest extends KernelTestBase { */ protected EntityTest $entity; + /** + * {@inheritdoc} + */ protected function setUp(): void { parent::setUp(); $this->database = $this->container->get('database'); diff --git a/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php index 49c598596f6dd6fc6f6894faeb36300324363ec8..5a2a07706b1904a0050b0a2ed1d20224e12369b2 100644 --- a/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php +++ b/core/modules/locale/tests/src/Kernel/LocaleConfigurableLanguageManagerTest.php @@ -22,6 +22,9 @@ class LocaleConfigurableLanguageManagerTest extends KernelTestBase { */ protected static $modules = ['language', 'locale']; + /** + * Tests retrieving languages from the language manager. + */ public function testGetLanguages(): void { $this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']); $default_language = ConfigurableLanguage::create(['label' => $this->randomMachineName(), 'id' => 'default', 'weight' => 0]); diff --git a/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php b/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php index 34666b8b7fa098590ea9c6ea0756feb1a4f35d79..c0b76119e2b951a3752c3b745a26b218c84e0c22 100644 --- a/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php +++ b/core/modules/locale/tests/src/Kernel/LocaleDefaultConfigStorageTest.php @@ -23,6 +23,9 @@ class LocaleDefaultConfigStorageTest extends KernelTestBase { 'locale_test_translate', ]; + /** + * Tests retrieval of component names from locale default config storage. + */ public function testGetComponentNames(): void { $storage = new LocaleDefaultConfigStorage( new NullStorage(), diff --git a/core/modules/media/tests/src/Kernel/ConfigActionsTest.php b/core/modules/media/tests/src/Kernel/ConfigActionsTest.php index 98e765c689a2d131a8a59d70e11e845fd3590dab..6da5d4d1419fb4c0d2026b51b208a199435f7b11 100644 --- a/core/modules/media/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/media/tests/src/Kernel/ConfigActionsTest.php @@ -35,6 +35,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of configuration actions on a media type. + */ public function testConfigActions(): void { $media_type = MediaType::load('test'); $this->assertSame('Test type.', $media_type->getDescription()); diff --git a/core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php b/core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php index 65ae4fe37f65d36c971540e5deb6b997f32d96d4..4edf12fd2f6de946ffb72049a42c20994d048c60 100644 --- a/core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php +++ b/core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php @@ -118,6 +118,9 @@ public function __construct($entity) { $this->entity = $entity; } + /** + * Returns the test entity. + */ public function getEntity(): Media { return $this->entity; } diff --git a/core/modules/menu_ui/tests/src/Kernel/Migrate/MigrateMenuSettingsTest.php b/core/modules/menu_ui/tests/src/Kernel/Migrate/MigrateMenuSettingsTest.php index 002906f1ce9635ebf087c71427294c07aa40469a..fbdc925042db2c90ea8bdbd8b0ad9b0aa8a57a79 100644 --- a/core/modules/menu_ui/tests/src/Kernel/Migrate/MigrateMenuSettingsTest.php +++ b/core/modules/menu_ui/tests/src/Kernel/Migrate/MigrateMenuSettingsTest.php @@ -27,6 +27,9 @@ protected function setUp(): void { $this->executeMigration('menu_settings'); } + /** + * Tests migration of menu_ui settings. + */ public function testMigration(): void { $this->assertTrue(\Drupal::config('menu_ui.settings')->get('override_parent_selector')); } diff --git a/core/modules/node/tests/src/Kernel/ConfigActionsTest.php b/core/modules/node/tests/src/Kernel/ConfigActionsTest.php index 9a682cbe0d740431f9d9e8a6db4432e045a778a2..c24468451efa497c2a3a6d50ec72e30d5f38cb79 100644 --- a/core/modules/node/tests/src/Kernel/ConfigActionsTest.php +++ b/core/modules/node/tests/src/Kernel/ConfigActionsTest.php @@ -37,6 +37,9 @@ protected function setUp(): void { $this->configActionManager = $this->container->get('plugin.manager.config_action'); } + /** + * Tests the application of configuration actions on a node type. + */ public function testConfigActions(): void { $node_type = $this->createContentType(); diff --git a/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php b/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php index b9004855b57ffdc5889ce12c3ad93b110371b202..34ccc0c3e8d5adff533677ef2cbfc8327d025151 100644 --- a/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php +++ b/core/modules/node/tests/src/Kernel/Views/RevisionCreateTimestampTest.php @@ -42,6 +42,9 @@ protected function setUp($import_test_views = TRUE): void { } } + /** + * Tests the revision create timestamp view. + */ public function testRevisionCreateTimestampView(): void { $node_type = NodeType::create([ 'type' => 'article', diff --git a/core/modules/package_manager/tests/src/Kernel/PathExcluder/UnknownPathExcluderTest.php b/core/modules/package_manager/tests/src/Kernel/PathExcluder/UnknownPathExcluderTest.php index d68da1cba9aac56db0cf965f9ded0781addd9746..03913aa6c2bf8554c0b4caf9fce842599ef3cb3a 100644 --- a/core/modules/package_manager/tests/src/Kernel/PathExcluder/UnknownPathExcluderTest.php +++ b/core/modules/package_manager/tests/src/Kernel/PathExcluder/UnknownPathExcluderTest.php @@ -228,6 +228,9 @@ public function testExcluderCanBeDisabled(): void { $this->assertFileDoesNotExist($stage->getStageDirectory() . '/unknown/file.txt'); } + /** + * Tests that path repositories are included. + */ public function testPathRepositoriesAreIncluded(): void { $this->createTestProjectForTemplate(TRUE); diff --git a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php index 3ce0238cfd7b9c2397bb5a5e674e918a98ce56e1..3e5606b8645e27db6e9dc6aa0515e69efb164280 100644 --- a/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php +++ b/core/modules/rest/tests/src/Kernel/RequestHandlerTest.php @@ -105,12 +105,24 @@ public function testHandle(): void { */ class StubRequestHandlerResourcePlugin extends ResourceBase { + /** + * Handles a GET request. + */ public function get($example = NULL, ?Request $request = NULL) {} + /** + * Handles a POST request. + */ public function post() {} + /** + * Handles a PATCH request. + */ public function patch($data, Request $request) {} + /** + * Handles a DELETE request. + */ public function delete() {} } diff --git a/core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php b/core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php index 0d5483370be83fcb299fa1ce968b63003b0fcb34..6c8c42da59e89e7eafa40fa45422dfeb7e4878e4 100644 --- a/core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php @@ -70,6 +70,12 @@ public function testAccess($permissions, $which_entity, $view_label_access_resul static::assertEquals($create_access_result, $this->accessControlHandler->createAccess(NULL, $user, [], TRUE)); } + /** + * Provides test cases for access control based on user permissions and entity lock status. + * + * @return array + * An array of test cases. + */ public static function providerTestAccess(): array { $c = new ContainerBuilder(); $cache_contexts_manager = (new Prophet())->prophesize(CacheContextsManager::class); diff --git a/core/modules/system/tests/src/Kernel/MenuAccessControlHandlerTest.php b/core/modules/system/tests/src/Kernel/MenuAccessControlHandlerTest.php index 57e1758cb8f85188ccfbe9f6556789ded3197ffb..b8fcf1c511840f94573abe6ed61b126e4a2fc580 100644 --- a/core/modules/system/tests/src/Kernel/MenuAccessControlHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/MenuAccessControlHandlerTest.php @@ -65,6 +65,12 @@ public function testAccess($permissions, $which_entity, $view_label_access_resul static::assertEquals($create_access_result, $this->accessControlHandler->createAccess(NULL, $user, [], TRUE)); } + /** + * Provides test cases for menu access control based on user permissions and menu lock status. + * + * @return array + * An array of test cases. + */ public static function providerTestAccess(): array { // RefinableCacheableDependencyTrait::addCacheContexts() only needs the // container to perform an assertion, but we can't use the container here, diff --git a/core/modules/taxonomy/tests/src/Kernel/PendingRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/PendingRevisionTest.php index 0030b64b08c8a4085653884f3af250c5fff0dd07..981676fe0c2a022240d98d9f8fe34eda1265f208 100644 --- a/core/modules/taxonomy/tests/src/Kernel/PendingRevisionTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/PendingRevisionTest.php @@ -121,6 +121,9 @@ public function testTaxonomyIndexWithPendingRevision(): void { $this->assertEquals($term->id(), $taxonomy_index[$node->id()]->tid); } + /** + * Retrieves the taxonomy index from the database. + */ protected function getTaxonomyIndex() { return \Drupal::database()->select('taxonomy_index') ->fields('taxonomy_index') diff --git a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php index eea33c764b12c282eaa5f4e38ebfd36820d3716d..afa6fda05c394d27fa99d2e917a2c2fb638a77d8 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php @@ -65,6 +65,9 @@ public function testNodePath(): void { $view->destroy(); } + /** + * Tests the entity reference field using a view for selection. + */ public function testNodePathWithViewSelection(): void { // Change the term entity reference field to use a view as selection plugin. \Drupal::service('module_installer')->install(['entity_reference_test']); @@ -87,6 +90,9 @@ public function testNodePathWithViewSelection(): void { $this->assertEquals($this->nodes[0]->getCacheTags(), $view->argument['tid']->getPlugin('argument_default')->getCacheTags()); } + /** + * Tests the behavior of term ID argument when accessing a term path. + */ public function testTermPath(): void { $view = $this->initViewWithRequest($this->term1->toUrl()->toString()); diff --git a/core/modules/user/tests/src/Kernel/UserRoleEntityTest.php b/core/modules/user/tests/src/Kernel/UserRoleEntityTest.php index 11c0f5f8aa8f5322a3a07f064e448788280ba781..6a4695cfc5b914c81521a043a77241c32c4dd00f 100644 --- a/core/modules/user/tests/src/Kernel/UserRoleEntityTest.php +++ b/core/modules/user/tests/src/Kernel/UserRoleEntityTest.php @@ -31,6 +31,9 @@ public function register(ContainerBuilder $container): void { ->addTag('logger'); } + /** + * Tests the order of granted permissions in a role. + */ public function testOrderOfPermissions(): void { $role = Role::create(['id' => 'test_role', 'label' => 'Test role']); $role->grantPermission('b') @@ -46,6 +49,9 @@ public function testOrderOfPermissions(): void { $this->assertEquals(['a', 'b', 'c'], $role->getPermissions()); } + /** + * Tests granting non-existent permissions to a role. + */ public function testGrantingNonExistentPermission(): void { $role = Role::create(['id' => 'test_role', 'label' => 'Test role']); @@ -73,6 +79,9 @@ public function testGrantingNonExistentPermission(): void { $this->assertEmpty(array_intersect(['does not exist', 'also does not exist'], $permissions)); } + /** + * Tests permission revocation during a configuration synchronization. + */ public function testPermissionRevokeAndConfigSync(): void { $role = Role::create(['id' => 'test_role', 'label' => 'Test role']); $role->setSyncing(TRUE); diff --git a/core/modules/user/tests/src/Kernel/Views/UserViewsFieldAccessTest.php b/core/modules/user/tests/src/Kernel/Views/UserViewsFieldAccessTest.php index 2b7953cc9619a5e342bb0e26cdbbcc0b22026c36..fffda3d83451792ee383a810b8c46ab40d4aea83 100644 --- a/core/modules/user/tests/src/Kernel/Views/UserViewsFieldAccessTest.php +++ b/core/modules/user/tests/src/Kernel/Views/UserViewsFieldAccessTest.php @@ -29,6 +29,9 @@ protected function setUp($import_test_views = TRUE): void { $this->installEntitySchema('user'); } + /** + * Tests the user fields. + */ public function testUserFields(): void { ConfigurableLanguage::createFromLangcode('es')->save(); ConfigurableLanguage::createFromLangcode('fr')->save(); diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaTextTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaTextTest.php index 089c37c90288f35e598d8ba5d0ba116f190dfe75..a96bb66e65200e539f74b0707f55c9596d4dd688 100644 --- a/core/modules/views/tests/src/Kernel/Handler/AreaTextTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaTextTest.php @@ -37,6 +37,9 @@ protected function setUp($import_test_views = TRUE): void { $this->installEntitySchema('user'); } + /** + * Tests the rendering of a text area. + */ public function testAreaText(): void { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); diff --git a/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php b/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php index 8643ddcf0327af54bf8ab3012973c40c57112d0d..f48cbf89b40b37742abf9cd02ac70794ae1bba23 100644 --- a/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php @@ -21,6 +21,9 @@ class ArgumentNullTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Defines Views data, setting the 'id' argument to use the null handler. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['id']['argument']['id'] = 'null'; @@ -28,6 +31,9 @@ public function viewsData() { return $data; } + /** + * Tests the NullArgument handler for text areas. + */ public function testAreaText(): void { // Test validation $view = Views::getView('test_view'); diff --git a/core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php b/core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php index db630c9ac591cbc8e25245e6b0fe7734680208a0..09a489e3105cea728ccecc47baa28a84bfb35357 100644 --- a/core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php @@ -30,6 +30,9 @@ protected function setUp($import_test_views = TRUE): void { ConfigurableLanguage::create(['id' => 'es', 'title' => 'Spanish title', 'label' => 'Spanish label'])->save(); } + /** + * Tests field access permissions for the 'entity_test' entity in Views. + */ public function testEntityTestFields(): void { $entity_test = EntityTest::create([ 'name' => 'test entity name', diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php index a60a3f13f50fc41407e0d80140db3fb7ed00475d..2d1c79b71c3574aa1dd56203a2bf60cc80c998b6 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php @@ -21,6 +21,9 @@ class FieldBooleanTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Modifies the default dataset by removing the age for specific entries. + */ public function dataSet() { // Use default dataset but remove the age from john and paul $data = parent::dataSet(); @@ -29,12 +32,18 @@ public function dataSet() { return $data; } + /** + * Provides Views data definition for the 'age' field as a boolean. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['age']['field']['id'] = 'boolean'; return $data; } + /** + * Tests different display formats for a boolean field in Views. + */ public function testFieldBoolean(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php index 5bf8f445fde945426cd757f6d950106a7f794b21..b9b934c9e7eca06f3ab22c94a2a19a3873aabb3b 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldCounterTest.php @@ -26,6 +26,9 @@ class FieldCounterTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Tests the behavior of a simple View rendering with overridden field options. + */ public function testSimple(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFileSizeTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFileSizeTest.php index f29de027ba4df18c70c5393c39d5560954cecda9..b897a7ad73ebba6fd55292594cb975e655b10f16 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldFileSizeTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldFileSizeTest.php @@ -22,6 +22,9 @@ class FieldFileSizeTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Provides a dataset with various 'age' values representing file sizes. + */ public function dataSet() { $data = parent::dataSet(); $data[0]['age'] = 0; @@ -32,6 +35,9 @@ public function dataSet() { return $data; } + /** + * Maps the 'age' field to the 'file_size' handler for Views. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['age']['field']['id'] = 'file_size'; @@ -39,6 +45,9 @@ public function viewsData() { return $data; } + /** + * Tests the FileSize field handler for correct formatting in Views. + */ public function testFieldFileSize(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldUrlTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldUrlTest.php index 71437e6e7e0fb77b50ed44a13b86e22bafd9e165..10386570842ccff31c57409c9bc175b1549cb134 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldUrlTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldUrlTest.php @@ -28,12 +28,18 @@ class FieldUrlTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Defines the Views data for the test entity. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['name']['field']['id'] = 'url'; return $data; } + /** + * Tests the rendering of a field as a plain text value and as a link. + */ public function testFieldUrl(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php index 4375484772266eda1b00d7aee3f77c57dcce290d..caf508cb95c200bc189e0633e6fd9f7c20458f94 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php @@ -48,6 +48,9 @@ protected function setUp($import_test_views = TRUE): void { $this->installEntitySchema('entity_test'); } + /** + * Tests the Combine field filter with the 'contains' operator. + */ public function testFilterCombineContains(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterEqualityTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterEqualityTest.php index a2ba005a0bdbd93eaab4b197535936e0c78078f6..aeb4d145c1e02b9d6de1e2b53a022ae3a418cddd 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterEqualityTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterEqualityTest.php @@ -35,12 +35,18 @@ class FilterEqualityTest extends ViewsKernelTestBase { 'views_test_data_name' => 'name', ]; + /** + * Defines Views data, mapping 'name' field to the equality filter. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['name']['filter']['id'] = 'equality'; return $data; } + /** + * Tests filtering names where the value matches exactly. + */ public function testEqual(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -66,6 +72,9 @@ public function testEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped, exposed equality filtering. + */ public function testEqualGroupedExposed(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -86,6 +95,9 @@ public function testEqualGroupedExposed(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering names using a not-equal condition. + */ public function testNotEqual(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -120,6 +132,9 @@ public function testNotEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped, non-exposed inequality filtering. + */ public function testEqualGroupedNotExposed(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -149,6 +164,9 @@ public function testEqualGroupedNotExposed(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Provides grouped exposed filter options for the 'name' field. + */ protected function getGroupedExposedFilters(): array { $filters = [ 'name' => [ diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php index e16e6f2cff878de353de66df9c20c0578a8065a5..e812d2fd4170620cce1a92d0f331b4d55419a929 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php @@ -41,12 +41,18 @@ class FilterInOperatorTest extends ViewsKernelTestBase { 'views_test_data_age' => 'age', ]; + /** + * Defines Views data for the custom entity. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['age']['filter']['id'] = 'in_operator'; return $data; } + /** + * Tests filtering using the "IN" and "NOT IN" operators on the age field. + */ public function testFilterInOperatorSimple(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -113,6 +119,9 @@ public function testFilterInOperatorSimple(): void { $this->assertIdenticalResultset($view, $expected_result, $this->columnMap); } + /** + * Tests filtering with grouped exposed filters using the "IN" operator. + */ public function testFilterInOperatorGroupedExposedSimple(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -139,6 +148,9 @@ public function testFilterInOperatorGroupedExposedSimple(): void { $this->assertIdenticalResultset($view, $expected_result, $this->columnMap); } + /** + * Tests filtering with grouped exposed filters using the "NOT IN" operator. + */ public function testFilterNotInOperatorGroupedExposedSimple(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -202,6 +214,12 @@ public function testFilterGroupedChangedIdentifier(): void { $this->assertIdenticalResultset($view, $expected_result, $this->columnMap); } + /** + * Returns grouped exposed filter definitions for Views. + * + * @return array + * An array of grouped exposed filters. + */ protected function getGroupedExposedFilters(): array { $filters = [ 'age' => [ diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php index 27deea250d00e8887eb5e4dc9318222abdc05819..b0a355f8dbdc2a82c0c416df9c5fc104040aa4da 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterNumericTest.php @@ -37,6 +37,9 @@ class FilterNumericTest extends ViewsKernelTestBase { 'views_test_data_age' => 'age', ]; + /** + * Defines Views data, allowing 'age' to be empty and 'id' to be required. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['age']['filter']['allow empty'] = TRUE; @@ -45,6 +48,9 @@ public function viewsData() { return $data; } + /** + * Tests filtering records using an exact match on a numeric field. + */ public function testFilterNumericSimple(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -71,6 +77,9 @@ public function testFilterNumericSimple(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering using exposed grouped filters. + */ public function testFilterNumericExposedGroupedSimple(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -195,6 +204,9 @@ public static function providerTestFilterNumericBetween() { ]; } + /** + * Tests filtering records using a ranged condition on a numeric field. + */ public function testFilterNumericExposedGroupedBetween(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -224,6 +236,9 @@ public function testFilterNumericExposedGroupedBetween(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering records outside a specified numeric range. + */ public function testFilterNumericExposedGroupedNotBetween(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -388,6 +403,9 @@ public function testFilterNumericExposedGroupedNotRegularExpression(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering records based on empty and non-empty values. + */ public function testFilterNumericEmpty(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -447,6 +465,9 @@ public function testFilterNumericEmpty(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering exposed grouped records based on empty values. + */ public function testFilterNumericExposedGroupedEmpty(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -463,6 +484,9 @@ public function testFilterNumericExposedGroupedEmpty(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering exposed grouped records based on non-empty values. + */ public function testFilterNumericExposedGroupedNotEmpty(): void { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); @@ -500,6 +524,9 @@ public function testFilterNumericExposedGroupedNotEmpty(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests whether empty filters are allowed for specific fields. + */ public function testAllowEmpty(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -530,6 +557,12 @@ public function testAllowEmpty(): void { $this->assertTrue(isset($age_operators['not empty'])); } + /** + * Returns predefined grouped filter configurations for 'age'. + * + * @return array + * An array of grouped exposed filters. + */ protected function getGroupedExposedFilters(): array { $filters = [ 'age' => [ diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php index c05b04ad18ce186fdc7452fbd5415cbc1674a741..96d7f91c6fc9c0b5cb85751f727a593c93d0c1ec 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FilterStringTest.php @@ -37,6 +37,9 @@ class FilterStringTest extends ViewsKernelTestBase { 'views_test_data_name' => 'name', ]; + /** + * Defines Views data for the custom entity. + */ public function viewsData() { $data = parent::viewsData(); $data['views_test_data']['name']['filter']['allow empty'] = TRUE; @@ -92,6 +95,9 @@ protected function getBasicPageView() { return $view; } + /** + * Tests the string filter with the 'equal' operator. + */ public function testFilterStringEqual(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -156,6 +162,9 @@ public function testFilterStringEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Returns a set of grouped exposed filters. + */ public function testFilterStringGroupedExposedEqual(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -177,6 +186,9 @@ public function testFilterStringGroupedExposedEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests the string filter with the 'not equal' operator. + */ public function testFilterStringNotEqual(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -211,6 +223,9 @@ public function testFilterStringNotEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped, exposed filtering with not equal operator. + */ public function testFilterStringGroupedExposedNotEqual(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -242,6 +257,9 @@ public function testFilterStringGroupedExposedNotEqual(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests the string filter with the 'contains' operator. + */ public function testFilterStringContains(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -267,6 +285,9 @@ public function testFilterStringContains(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped, exposed filtering with contains operator. + */ public function testFilterStringGroupedExposedContains(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -288,6 +309,9 @@ public function testFilterStringGroupedExposedContains(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by a word in the "description" field. + */ public function testFilterStringWord(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -376,6 +400,9 @@ public function testFilterStringWord(): void { $this->assertIdenticalResultset($view, $resultset); } + /** + * Tests grouped and exposed filters with word-based filtering. + */ public function testFilterStringGroupedExposedWord(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -417,6 +444,9 @@ public function testFilterStringGroupedExposedWord(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "starts with" operator. + */ public function testFilterStringStarts(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -442,6 +472,9 @@ public function testFilterStringStarts(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "starts with" operator. + */ public function testFilterStringGroupedExposedStarts(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -495,6 +528,9 @@ public function testFilterStringGroupedNotRegularExpression(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "does not start with" operator. + */ public function testFilterStringNotStarts(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -527,6 +563,9 @@ public function testFilterStringNotStarts(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "does not start with" operator. + */ public function testFilterStringGroupedExposedNotStarts(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -554,6 +593,9 @@ public function testFilterStringGroupedExposedNotStarts(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "ends with" operator. + */ public function testFilterStringEnds(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -582,6 +624,9 @@ public function testFilterStringEnds(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "ends with" operator. + */ public function testFilterStringGroupedExposedEnds(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -605,6 +650,9 @@ public function testFilterStringGroupedExposedEnds(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "does not end with" operator. + */ public function testFilterStringNotEnds(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -634,6 +682,9 @@ public function testFilterStringNotEnds(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "does not end with" operator. + */ public function testFilterStringGroupedExposedNotEnds(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -658,6 +709,9 @@ public function testFilterStringGroupedExposedNotEnds(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "does not contain" operator. + */ public function testFilterStringNot(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -687,6 +741,9 @@ public function testFilterStringNot(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "does not contain" operator. + */ public function testFilterStringGroupedExposedNot(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -712,6 +769,9 @@ public function testFilterStringGroupedExposedNot(): void { } + /** + * Tests filtering by string using the "shorter than" operator. + */ public function testFilterStringShorter(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -740,6 +800,9 @@ public function testFilterStringShorter(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "shorter than" operator. + */ public function testFilterStringGroupedExposedShorter(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -762,6 +825,9 @@ public function testFilterStringGroupedExposedShorter(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "longer than" operator. + */ public function testFilterStringLonger(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -787,6 +853,9 @@ public function testFilterStringLonger(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "longer than" operator. + */ public function testFilterStringGroupedExposedLonger(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -806,6 +875,9 @@ public function testFilterStringGroupedExposedLonger(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests filtering by string using the "empty" operator. + */ public function testFilterStringEmpty(): void { $view = Views::getView('test_view'); $view->setDisplay(); @@ -830,6 +902,9 @@ public function testFilterStringEmpty(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Tests grouped and exposed filters with the "empty" operator. + */ public function testFilterStringGroupedExposedEmpty(): void { $filters = $this->getGroupedExposedFilters(); $view = $this->getBasicPageView(); @@ -892,6 +967,9 @@ public function testFilterStringNotRegularExpression(): void { $this->assertIdenticalResultset($view, $resultset, $this->columnMap); } + /** + * Returns a set of grouped exposed filters. + */ protected function getGroupedExposedFilters(): array { $filters = [ 'name' => [ diff --git a/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php b/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php index 26d9ab1c73653436a573b99d9ab0da450f0493af..a66bd9b4c89a8b42c1641f4a4f1da024b110d137 100644 --- a/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php @@ -48,6 +48,9 @@ protected function viewsData() { return $data; } + /** + * Tests the behavior of plugin aliases in Views filters. + */ public function testPluginAliases(): void { $view = Views::getView('test_filter'); $view->initDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php index 65a4c892159974a3f134b962f1e95fcf44350ad3..a1d72775a75a36f9f19ef8e3f646affbb9362ddd 100644 --- a/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/SortDateTest.php @@ -21,6 +21,9 @@ class SortDateTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Generates an expected result set based on the specified granularity and order. + */ protected function expectedResultSet($granularity, $reverse = TRUE): array { $expected = []; if (!$reverse) { diff --git a/core/modules/views/tests/src/Kernel/Plugin/ArgumentValidatorTest.php b/core/modules/views/tests/src/Kernel/Plugin/ArgumentValidatorTest.php index 64d3b00e7b58f4cf22ffc9f613b39ab6c942b114..1b87608044a4eb33450eac122497a1ca7f9d84d4 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/ArgumentValidatorTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/ArgumentValidatorTest.php @@ -22,6 +22,9 @@ class ArgumentValidatorTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view_argument_validate_numeric', 'test_view']; + /** + * Tests numeric argument validation in a view. + */ public function testArgumentValidateNumeric(): void { $view = Views::getView('test_view_argument_validate_numeric'); $view->initHandlers(); diff --git a/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php b/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php index 42a3624e25da2a93f38686b19874c172ab43052f..3a400ce4565bd01157e57505a67ac71044ecfcf9 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php @@ -88,6 +88,9 @@ public function __construct() { parent::__construct([], '', []); } + /** + * {@inheritdoc} + */ public function viewsTokenReplace($text, $tokens) { return parent::viewsTokenReplace($text, $tokens); } diff --git a/core/modules/views/tests/src/Kernel/Plugin/QueryTest.php b/core/modules/views/tests/src/Kernel/Plugin/QueryTest.php index 22276d9e2dbb504431df1c07102e6c67f1c3be7b..bbd45990a2d9ecd82b0dee0e3cb9582f194dbca2 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/QueryTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/QueryTest.php @@ -22,6 +22,9 @@ class QueryTest extends ViewsKernelTestBase { */ public static $testViews = ['test_view']; + /** + * Provides Views metadata for the test data table. + */ protected function viewsData() { $data = parent::viewsData(); $data['views_test_data']['table']['base']['query_id'] = 'query_test'; @@ -49,6 +52,9 @@ public function _testInitQuery(): void { $this->assertInstanceOf(QueryTestPlugin::class, $view->query); } + /** + * Executes the views query, ensures it's not empty. + */ public function _testQueryExecute(): void { $view = Views::getView('test_view'); $view->setDisplay(); diff --git a/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php b/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php index 571f8d0ce0857e868b5e200ad88acc23d00f7767..1b3a2a38ad5ce6010b8f7e3dc3bac2bf59dec30a 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/SqlEntityLoadingTest.php @@ -39,6 +39,9 @@ protected function setUp($import_test_views = TRUE): void { $this->installSchema('node', 'node_access'); } + /** + * Tests entity loading with a non-default pending revision in Views. + */ public function testViewWithNonDefaultPendingRevision(): void { $node_type = NodeType::create([ 'type' => 'page', diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index 011d0af37542d4ecf68f5dab7cc495f0084dadd4..13232ef15452c4cee1bf5db6717594ed9226bf39 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -92,6 +92,9 @@ class ViewExecutableTest extends ViewsKernelTestBase { 'parent_views', ]; + /** + * Sets up the necessary fixtures for the test environment. + */ protected function setUpFixtures(): void { $this->installEntitySchema('user'); $this->installEntitySchema('node'); @@ -207,6 +210,9 @@ public function testProperties(): void { $this->assertEquals([], $view->getExposedInput()); } + /** + * Tests setting a display with an invalid display ID. + */ public function testSetDisplayWithInvalidDisplay(): void { \Drupal::service('module_installer')->install(['dblog']); $view = Views::getView('test_executable_displays'); diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 455c074e5c66e09f682fd19823069619d2a1b54d..56abaf1edc7fa06547ed7e2beddb34b31a552011 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -84,6 +84,7 @@ <include-pattern>core/modules/*/Plugin/views/style/*</include-pattern> <include-pattern>*/Database/*</include-pattern> <include-pattern>*/FunctionalJavascript/*</include-pattern> + <include-pattern>*/Kernel/*</include-pattern> <include-pattern>*/Functional/*</include-pattern> </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"/>