summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--composer.lock3
-rw-r--r--core/MAINTAINERS.txt1
-rw-r--r--core/composer.json3
-rw-r--r--core/core.services.yml9
-rw-r--r--core/includes/theme.inc421
-rw-r--r--core/lib/Drupal/Core/Breadcrumb/BreadcrumbPreprocess.php32
-rw-r--r--core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php34
-rw-r--r--core/lib/Drupal/Core/Entity/Query/QueryInterface.php6
-rw-r--r--core/lib/Drupal/Core/Menu/MenuPreprocess.php73
-rw-r--r--core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php3
-rw-r--r--core/lib/Drupal/Core/Render/Element/Table.php2
-rw-r--r--core/lib/Drupal/Core/Theme/ImagePreprocess.php90
-rw-r--r--core/lib/Drupal/Core/Theme/ThemeCommonElements.php14
-rw-r--r--core/lib/Drupal/Core/Theme/ThemePreprocess.php444
-rw-r--r--core/modules/field_ui/field_ui.module3
-rw-r--r--core/modules/mysqli/mysqli.install78
-rw-r--r--core/modules/mysqli/src/Hook/MysqliHooks.php70
-rw-r--r--core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php6
-rw-r--r--core/modules/package_manager/tests/src/Build/PackageInstallTest.php6
-rw-r--r--core/modules/package_manager/tests/src/Build/PackageUpdateTest.php5
-rw-r--r--core/modules/system/src/Hook/PageAttachmentsHook.php2
-rw-r--r--core/modules/system/templates/image.html.twig2
-rw-r--r--core/modules/system/templates/install-page.html.twig2
-rw-r--r--core/modules/system/templates/item-list.html.twig2
-rw-r--r--core/modules/system/templates/maintenance-page.html.twig2
-rw-r--r--core/modules/system/templates/menu-local-action.html.twig2
-rw-r--r--core/modules/system/templates/menu-local-task.html.twig2
-rw-r--r--core/modules/system/templates/region.html.twig2
-rw-r--r--core/modules/system/templates/table.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/dataset/table.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/layout/maintenance-page.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/classy/layout/region.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/components/navigation/menu-local-task.html.twig2
-rw-r--r--core/profiles/demo_umami/themes/umami/templates/layout/region--header.html.twig2
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php5
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php5
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php5
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php11
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php8
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroAvoidStorageUsingTest.php4
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php4
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php20
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php8
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php49
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php11
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php9
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php11
-rw-r--r--core/tests/Drupal/Tests/Component/Annotation/PluginTest.php23
-rw-r--r--core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php40
-rw-r--r--core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php9
-rw-r--r--core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php54
-rw-r--r--core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php19
-rw-r--r--core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php216
-rw-r--r--core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php8
-rw-r--r--core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php13
-rw-r--r--core/tests/Drupal/Tests/Component/Diff/DiffOpOutputBuilderTest.php21
-rw-r--r--core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php20
-rw-r--r--core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php4
-rw-r--r--core/tests/Drupal/Tests/Component/DrupalComponentTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php29
-rw-r--r--core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php15
-rw-r--r--core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php36
-rw-r--r--core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php8
-rw-r--r--core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php16
-rw-r--r--core/tests/Drupal/Tests/Component/Graph/GraphTest.php7
-rw-r--r--core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php11
-rw-r--r--core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php21
-rw-r--r--core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php4
-rw-r--r--core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php20
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php9
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php21
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php27
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php16
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php33
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php20
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php16
-rw-r--r--core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php16
-rw-r--r--core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php67
-rw-r--r--core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/Serialization/JsonTest.php7
-rw-r--r--core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php33
-rw-r--r--core/tests/Drupal/Tests/Component/Serialization/YamlTest.php30
-rw-r--r--core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php17
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/BytesTest.php19
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/ColorTest.php19
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/CryptTest.php21
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php11
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php11
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php13
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/FilterArrayTest.php13
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/HtmlTest.php54
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/ImageTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php30
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/NumberTest.php30
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/RandomTest.php32
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/RectangleTest.php21
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php12
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php34
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/TimerTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php37
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php70
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php14
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/VariableTest.php20
-rw-r--r--core/tests/Drupal/Tests/Component/Utility/XssTest.php28
-rw-r--r--core/tests/Drupal/Tests/Component/Uuid/UuidTest.php18
-rw-r--r--core/tests/Drupal/Tests/Component/Version/ConstraintTest.php12
-rw-r--r--core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php26
-rw-r--r--core/themes/claro/claro.theme2
-rw-r--r--core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig2
-rw-r--r--core/themes/claro/templates/classy/dataset/item-list.html.twig2
-rw-r--r--core/themes/claro/templates/classy/dataset/table.html.twig2
-rw-r--r--core/themes/claro/templates/classy/field/image.html.twig2
-rw-r--r--core/themes/claro/templates/classy/layout/region.html.twig2
-rw-r--r--core/themes/claro/templates/install-page.html.twig2
-rw-r--r--core/themes/claro/templates/maintenance-page--front.html.twig2
-rw-r--r--core/themes/claro/templates/maintenance-page.html.twig2
-rw-r--r--core/themes/claro/templates/media-library/item-list--media-library-add-form-media-list.html.twig2
-rw-r--r--core/themes/claro/templates/navigation/menu-local-task--views-ui.html.twig2
-rw-r--r--core/themes/claro/templates/navigation/menu-local-task.html.twig2
-rw-r--r--core/themes/claro/templates/region--breadcrumb.html.twig2
-rw-r--r--core/themes/olivero/olivero.theme2
-rw-r--r--core/themes/olivero/templates/dataset/item-list--search-results.html.twig2
-rw-r--r--core/themes/olivero/templates/dataset/item-list.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--breadcrumb.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--content-above.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--content-below.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--content.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--footer-bottom.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--footer-top.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--header.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--highlighted.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--primary-menu.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--secondary-menu.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--sidebar.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region--social.html.twig2
-rw-r--r--core/themes/olivero/templates/layout/region.html.twig2
-rw-r--r--core/themes/olivero/templates/maintenance-page.html.twig2
-rw-r--r--core/themes/olivero/templates/menu-local-action.html.twig2
-rw-r--r--core/themes/olivero/templates/navigation/menu-local-task.html.twig2
-rw-r--r--core/themes/stable9/templates/dataset/item-list.html.twig2
-rw-r--r--core/themes/stable9/templates/dataset/table.html.twig2
-rw-r--r--core/themes/stable9/templates/field/image.html.twig2
-rw-r--r--core/themes/stable9/templates/layout/install-page.html.twig2
-rw-r--r--core/themes/stable9/templates/layout/maintenance-page.html.twig2
-rw-r--r--core/themes/stable9/templates/layout/region.html.twig2
-rw-r--r--core/themes/stable9/templates/navigation/menu-local-action.html.twig2
-rw-r--r--core/themes/stable9/templates/navigation/menu-local-task.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/dataset/item-list.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/dataset/table.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/field/image.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/layout/maintenance-page.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/layout/region.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/navigation/menu-local-action.html.twig2
-rw-r--r--core/themes/starterkit_theme/templates/navigation/menu-local-task.html.twig2
217 files changed, 2082 insertions, 1461 deletions
diff --git a/composer.lock b/composer.lock
index 8601d07b621f..23f098b5b9a5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -497,7 +497,7 @@
"dist": {
"type": "path",
"url": "core",
- "reference": "a2b58b83685c78305e1448a22fc4b6d0efa3e16d"
+ "reference": "cc47b8e83dc7fe1fb24f2baa25102b85a24212de"
},
"require": {
"asm89/stack-cors": "^2.3",
@@ -551,6 +551,7 @@
"twig/twig": "^3.21.0"
},
"conflict": {
+ "dealerdirect/phpcodesniffer-composer-installer": "1.1.0",
"drupal/automatic_updates": "<4",
"drupal/project_browser": "<2.1",
"drush/drush": "<12.4.3"
diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt
index a81dcc29d301..09256dab56e1 100644
--- a/core/MAINTAINERS.txt
+++ b/core/MAINTAINERS.txt
@@ -483,7 +483,6 @@ Testing
Usability
- Cristina Chumillas 'ckrina' https://www.drupal.org/u/ckrina
-- Roy Scholten 'yoroy' https://www.drupal.org/u/yoroy
- Bojhan Somers 'Bojhan' https://www.drupal.org/u/bojhan
diff --git a/core/composer.json b/core/composer.json
index 1ef99e7496b0..63ebe5803f1f 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -57,7 +57,8 @@
"conflict": {
"drupal/automatic_updates": "<4",
"drupal/project_browser": "<2.1",
- "drush/drush": "<12.4.3"
+ "drush/drush": "<12.4.3",
+ "dealerdirect/phpcodesniffer-composer-installer": "1.1.0"
},
"replace": {
"drupal/core-annotation": "self.version",
diff --git a/core/core.services.yml b/core/core.services.yml
index 33e9498bbc4b..9f7c1a2d11cd 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -854,6 +854,9 @@ services:
class: Drupal\Core\Menu\ContextualLinkManager
arguments: ['@controller_resolver', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user', '@request_stack']
Drupal\Core\Menu\ContextualLinkManagerInterface: '@plugin.manager.menu.contextual_link'
+ Drupal\Core\Menu\MenuPreprocess:
+ class: Drupal\Core\Menu\MenuPreprocess
+ autowire: true
plugin.manager.display_variant:
class: Drupal\Core\Display\VariantManager
parent: default_plugin_manager
@@ -1535,6 +1538,9 @@ services:
tags:
- { name: service_collector, tag: breadcrumb_builder, call: addBuilder }
Drupal\Core\Breadcrumb\ChainBreadcrumbBuilderInterface: '@breadcrumb'
+ Drupal\Core\Breadcrumb\BreadcrumbPreprocess:
+ class: Drupal\Core\Breadcrumb\BreadcrumbPreprocess
+ autowire: true
token:
class: Drupal\Core\Utility\Token
arguments: ['@module_handler', '@cache.default', '@language_manager', '@cache_tags.invalidator', '@renderer']
@@ -1575,6 +1581,9 @@ services:
Drupal\Core\Theme\ThemePreprocess:
class: Drupal\Core\Theme\ThemePreprocess
autowire: true
+ Drupal\Core\Theme\ImagePreprocess:
+ class: Drupal\Core\Theme\ImagePreprocess
+ autowire: true
Drupal\Core\Datetime\DatePreprocess:
class: Drupal\Core\Datetime\DatePreprocess
autowire: true
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 6c5d563cb63a..587f9e70c200 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -11,16 +11,15 @@
use Drupal\Core\Datetime\DatePreprocess;
use Drupal\Core\Field\FieldPreprocess;
use Drupal\Core\Pager\PagerPreprocess;
+use Drupal\Core\Breadcrumb\BreadcrumbPreprocess;
+use Drupal\Core\Menu\MenuPreprocess;
+use Drupal\Core\Theme\ImagePreprocess;
use Drupal\Core\Theme\ThemePreprocess;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\StorageException;
-use Drupal\Core\Template\Attribute;
use Drupal\Core\Template\AttributeHelper;
use Drupal\Core\Theme\ThemeCommonElements;
use Drupal\Core\Theme\ThemeSettings;
-use Drupal\Core\Render\Element;
-use Drupal\Core\Utility\TableSort;
-use Drupal\Core\Installer\InstallerKernel;
/**
* @defgroup content_flags Content markers
@@ -483,49 +482,15 @@ function template_preprocess_links(&$variables): void {
* - sizes: The sizes attribute for viewport-based selection of images.
* phpcs:ignore
* - http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#introduction-3:viewport-based-selection-2
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_image(&$variables): void {
- /** @var \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator */
- $file_url_generator = \Drupal::service('file_url_generator');
-
- if (!empty($variables['uri'])) {
- $variables['attributes']['src'] = $file_url_generator->generateString($variables['uri']);
- }
- // Generate a srcset attribute conforming to the spec at
- // https://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset
- if (!empty($variables['srcset'])) {
- $srcset = [];
- foreach ($variables['srcset'] as $src) {
- // URI is mandatory.
- $source = $file_url_generator->generateString($src['uri']);
- if (isset($src['width']) && !empty($src['width'])) {
- $source .= ' ' . $src['width'];
- }
- elseif (isset($src['multiplier']) && !empty($src['multiplier'])) {
- $source .= ' ' . $src['multiplier'];
- }
- $srcset[] = $source;
- }
- $variables['attributes']['srcset'] = implode(', ', $srcset);
- }
-
- foreach (['width', 'height', 'alt', 'title', 'sizes'] as $key) {
- if (isset($variables[$key])) {
- // If the property has already been defined in the attributes,
- // do not override, including NULL.
- if (AttributeHelper::attributeExists($key, $variables['attributes'])) {
- continue;
- }
- $variables['attributes'][$key] = $variables[$key];
- }
- }
-
- // Without dimensions specified, layout shifts can occur,
- // which are more noticeable on pages that take some time to load.
- // As a result, only mark images as lazy load that have dimensions.
- if (isset($variables['width'], $variables['height']) && !isset($variables['attributes']['loading'])) {
- $variables['attributes']['loading'] = 'lazy';
- }
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ImagePreprocess::class)->preprocessImage($variables);
}
/**
@@ -619,167 +584,15 @@ function template_preprocess_image(&$variables): void {
* - sticky: Use a "sticky" table header.
* - empty: The message to display in an extra row if table does not have any
* rows.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_table(&$variables): void {
- // Format the table columns:
- if (!empty($variables['colgroups'])) {
- foreach ($variables['colgroups'] as &$colgroup) {
- // Check if we're dealing with a simple or complex column
- if (isset($colgroup['data'])) {
- $cols = $colgroup['data'];
- unset($colgroup['data']);
- $colgroup_attributes = $colgroup;
- }
- else {
- $cols = $colgroup;
- $colgroup_attributes = [];
- }
- $colgroup = [];
- $colgroup['attributes'] = new Attribute($colgroup_attributes);
- $colgroup['cols'] = [];
-
- // Build columns.
- if (is_array($cols) && !empty($cols)) {
- foreach ($cols as $col_key => $col) {
- $colgroup['cols'][$col_key]['attributes'] = new Attribute($col);
- }
- }
- }
- }
-
- // Build an associative array of responsive classes keyed by column.
- $responsive_classes = [];
-
- // Format the table header:
- $ts = [];
- $header_columns = 0;
- if (!empty($variables['header'])) {
- $ts = TableSort::getContextFromRequest($variables['header'], \Drupal::request());
-
- // Use a separate index with responsive classes as headers
- // may be associative.
- $responsive_index = -1;
- foreach ($variables['header'] as $col_key => $cell) {
- // Increase the responsive index.
- $responsive_index++;
-
- if (!is_array($cell)) {
- $header_columns++;
- $cell_content = $cell;
- $cell_attributes = new Attribute();
- $is_header = TRUE;
- }
- else {
- if (isset($cell['colspan'])) {
- $header_columns += $cell['colspan'];
- }
- else {
- $header_columns++;
- }
- $cell_content = '';
- if (isset($cell['data'])) {
- $cell_content = $cell['data'];
- unset($cell['data']);
- }
- // Flag the cell as a header or not and remove the flag.
- $is_header = $cell['header'] ?? TRUE;
- unset($cell['header']);
-
- // Track responsive classes for each column as needed. Only the header
- // cells for a column are marked up with the responsive classes by a
- // module developer or themer. The responsive classes on the header
- // cells must be transferred to the content cells.
- if (!empty($cell['class']) && is_array($cell['class'])) {
- if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) {
- $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_MEDIUM;
- }
- elseif (in_array(RESPONSIVE_PRIORITY_LOW, $cell['class'])) {
- $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_LOW;
- }
- }
-
- TableSort::header($cell_content, $cell, $variables['header'], $ts);
-
- // TableSort::header() removes the 'sort', 'initial_click_sort' and
- // 'field' keys.
- $cell_attributes = new Attribute($cell);
- }
- $variables['header'][$col_key] = [];
- $variables['header'][$col_key]['tag'] = $is_header ? 'th' : 'td';
- $variables['header'][$col_key]['attributes'] = $cell_attributes;
- $variables['header'][$col_key]['content'] = $cell_content;
- }
- }
- $variables['header_columns'] = $header_columns;
-
- // Rows and footer have the same structure.
- $sections = ['rows' , 'footer'];
- foreach ($sections as $section) {
- if (!empty($variables[$section])) {
- foreach ($variables[$section] as $row_key => $row) {
- $cells = $row;
- $row_attributes = [];
-
- // Check if we're dealing with a simple or complex row
- if (isset($row['data'])) {
- $cells = $row['data'];
- $variables['no_striping'] = $row['no_striping'] ?? FALSE;
-
- // Set the attributes array and exclude 'data' and 'no_striping'.
- $row_attributes = $row;
- unset($row_attributes['data']);
- unset($row_attributes['no_striping']);
- }
-
- // Build row.
- $variables[$section][$row_key] = [];
- $variables[$section][$row_key]['attributes'] = new Attribute($row_attributes);
- $variables[$section][$row_key]['cells'] = [];
- if (!empty($cells)) {
- // Reset the responsive index.
- $responsive_index = -1;
- foreach ($cells as $col_key => $cell) {
- // Increase the responsive index.
- $responsive_index++;
-
- if (!is_array($cell)) {
- $cell_content = $cell;
- $cell_attributes = [];
- $is_header = FALSE;
- }
- else {
- $cell_content = '';
- if (isset($cell['data'])) {
- $cell_content = $cell['data'];
- unset($cell['data']);
- }
-
- // Flag the cell as a header or not and remove the flag.
- $is_header = !empty($cell['header']);
- unset($cell['header']);
-
- $cell_attributes = $cell;
- }
- // Active table sort information.
- if (isset($variables['header'][$col_key]['data']) && $variables['header'][$col_key]['data'] == $ts['name'] && !empty($variables['header'][$col_key]['field'])) {
- $variables[$section][$row_key]['cells'][$col_key]['active_table_sort'] = TRUE;
- }
- // Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM
- // class from header to cell as needed.
- if (isset($responsive_classes[$responsive_index])) {
- $cell_attributes['class'][] = $responsive_classes[$responsive_index];
- }
- $variables[$section][$row_key]['cells'][$col_key]['tag'] = $is_header ? 'th' : 'td';
- $variables[$section][$row_key]['cells'][$col_key]['attributes'] = new Attribute($cell_attributes);
- $variables[$section][$row_key]['cells'][$col_key]['content'] = $cell_content;
- }
- }
- }
- }
- }
- if (empty($variables['no_striping'])) {
- $variables['attributes']['data-striping'] = 1;
- }
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessTable($variables);
}
/**
@@ -799,56 +612,14 @@ function template_preprocess_table(&$variables): void {
* - list_type: The type of list to return (e.g. "ul", "ol").
* - wrapper_attributes: HTML attributes to be applied to the list wrapper.
*
- * @see https://www.drupal.org/node/1842756
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_item_list(&$variables): void {
- $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);
- $variables['#attached']['library'][] = 'core/drupal.item-list';
- foreach ($variables['items'] as &$item) {
- $attributes = [];
- // If the item value is an array, then it is a render array.
- if (is_array($item)) {
- // List items support attributes via the '#wrapper_attributes' property.
- if (isset($item['#wrapper_attributes'])) {
- $attributes = $item['#wrapper_attributes'];
- }
- // Determine whether there are any child elements in the item that are not
- // fully-specified render arrays. If there are any, then the child
- // elements present nested lists and we automatically inherit the render
- // array properties of the current list to them.
- foreach (Element::children($item) as $key) {
- $child = &$item[$key];
- // If this child element does not specify how it can be rendered, then
- // we need to inherit the render properties of the current list.
- if (!isset($child['#type']) && !isset($child['#theme']) && !isset($child['#markup'])) {
- // Since item-list.html.twig supports both strings and render arrays
- // as items, the items of the nested list may have been specified as
- // the child elements of the nested list, instead of #items. For
- // convenience, we automatically move them into #items.
- if (!isset($child['#items'])) {
- // This is the same condition as in
- // \Drupal\Core\Render\Element::children(), which cannot be used
- // here, since it triggers an error on string values.
- foreach ($child as $child_key => $child_value) {
- if (is_int($child_key) || $child_key === '' || $child_key[0] !== '#') {
- $child['#items'][$child_key] = $child_value;
- unset($child[$child_key]);
- }
- }
- }
- // Lastly, inherit the original theme variables of the current list.
- $child['#theme'] = $variables['theme_hook_original'];
- $child['#list_type'] = $variables['list_type'];
- }
- }
- }
-
- // Set the item's value and attributes for the template.
- $item = [
- 'value' => $item,
- 'attributes' => new Attribute($attributes),
- ];
- }
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessItemList($variables);
}
/**
@@ -882,27 +653,15 @@ function template_preprocess_container(&$variables): void {
* It's the caller's responsibility to ensure this array's items contain no
* dangerous HTML such as <script> tags.
* - active: The key for the currently active maintenance task.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_maintenance_task_list(&$variables): void {
- $items = $variables['items'];
- $active = $variables['active'];
-
- $done = isset($items[$active]) || $active == NULL;
- foreach ($items as $k => $item) {
- $variables['tasks'][$k]['item'] = $item;
- $variables['tasks'][$k]['attributes'] = new Attribute();
- if ($active == $k) {
- $variables['tasks'][$k]['attributes']->addClass('is-active');
- $variables['tasks'][$k]['status'] = t('active');
- $done = FALSE;
- }
- else {
- if ($done) {
- $variables['tasks'][$k]['attributes']->addClass('done');
- $variables['tasks'][$k]['status'] = t('done');
- }
- }
- }
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessMaintenanceTaskList($variables);
}
/**
@@ -1052,9 +811,15 @@ function theme_get_suggestions($args, $base, $delimiter = '__'): array {
* Prepares variables for tablesort indicators.
*
* Default template: tablesort-indicator.html.twig.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_tablesort_indicator(&$variables): void {
- $variables['#attached']['library'][] = 'core/drupal.tablesort';
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessTablesortIndicator($variables);
}
/**
@@ -1066,25 +831,14 @@ function template_preprocess_tablesort_indicator(&$variables): void {
* An associative array containing:
* - content - An array of page content.
*
- * @see system_page_attachments()
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_maintenance_page(&$variables): void {
- // @todo Rename the templates to page--maintenance + page--install.
- \Drupal::service(ThemePreprocess::class)->preprocessPage($variables);
-
- // @see system_page_attachments()
- $variables['#attached']['library'][] = 'system/maintenance';
-
- // Maintenance page and install page need branding info in variables because
- // there is no blocks.
- $site_config = \Drupal::config('system.site');
- $variables['logo'] = theme_get_setting('logo.url');
- $variables['site_name'] = $site_config->get('name');
- $variables['site_slogan'] = $site_config->get('slogan');
-
- // Maintenance page and install page need page title in variable because there
- // are no blocks.
- $variables['title'] = $variables['page']['#title'];
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessMaintenancePage($variables);
}
/**
@@ -1096,21 +850,14 @@ function template_preprocess_maintenance_page(&$variables): void {
* An associative array containing:
* - content - An array of page content.
*
- * @see template_preprocess_maintenance_page()
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_install_page(&$variables): void {
- $installer_active_task = NULL;
- if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install' && InstallerKernel::installationAttempted()) {
- $installer_active_task = $GLOBALS['install_state']['active_task'];
- }
-
- template_preprocess_maintenance_page($variables);
-
- // Override the site name that is displayed on the page, since Drupal is
- // still in the process of being installed.
- $distribution_name = drupal_install_profile_distribution_name();
- $variables['site_name'] = $distribution_name;
- $variables['site_version'] = $installer_active_task ? drupal_install_profile_distribution_version() : '';
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessInstallPage($variables);
}
/**
@@ -1125,11 +872,15 @@ function template_preprocess_install_page(&$variables): void {
* @param array $variables
* An associative array containing:
* - elements: An associative array containing properties of the region.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_region(&$variables): void {
- // Create the $content variable that templates expect.
- $variables['content'] = $variables['elements']['#children'];
- $variables['region'] = $variables['elements']['#region'];
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(ThemePreprocess::class)->preprocessRegion($variables);
}
/**
@@ -1182,13 +933,15 @@ function template_preprocess_field_multiple_value_form(&$variables): void {
* @param array $variables
* An associative array containing:
* - links: A list of \Drupal\Core\Link objects which should be rendered.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_breadcrumb(&$variables): void {
- $variables['breadcrumb'] = [];
- /** @var \Drupal\Core\Link $link */
- foreach ($variables['links'] as $key => $link) {
- $variables['breadcrumb'][$key] = ['text' => $link->getText(), 'url' => $link->getUrl()->toString()];
- }
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(BreadcrumbPreprocess::class)->preprocessBreadcrumb($variables);
}
/**
@@ -1212,7 +965,7 @@ function template_preprocess_breadcrumb(&$variables): void {
* - #route_parameters: An associative array of the route parameters.
* - #quantity: The number of pages in the list.
*
- * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Initial
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
* template_preprocess functions are registered directly in hook_theme().
*
* @see https://www.drupal.org/node/3504125
@@ -1233,26 +986,15 @@ function template_preprocess_pager(&$variables): void {
* - #link: A menu link array with 'title', 'url', and (optionally)
* 'localized_options' keys.
* - #active: A boolean indicating whether the local task is active.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_menu_local_task(&$variables): void {
- $link = $variables['element']['#link'];
- $link += [
- 'localized_options' => [],
- ];
- $link_text = $link['title'];
-
- if (!empty($variables['element']['#active'])) {
- $variables['is_active'] = TRUE;
- }
-
- $link['localized_options']['set_active_class'] = TRUE;
-
- $variables['link'] = [
- '#type' => 'link',
- '#title' => $link_text,
- '#url' => $link['url'],
- '#options' => $link['localized_options'],
- ];
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(MenuPreprocess::class)->preprocessMenuLocalTask($variables);
}
/**
@@ -1265,22 +1007,15 @@ function template_preprocess_menu_local_task(&$variables): void {
* - element: A render element containing:
* - #link: A menu link array with 'title', 'url', and (optionally)
* 'localized_options' keys.
+ *
+ * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial
+ * template_preprocess functions are registered directly in hook_theme().
+ *
+ * @see https://www.drupal.org/node/3504125
*/
function template_preprocess_menu_local_action(&$variables): void {
- $link = $variables['element']['#link'];
- $link += [
- 'localized_options' => [],
- ];
- $link['localized_options']['attributes']['class'][] = 'button';
- $link['localized_options']['attributes']['class'][] = 'button-action';
- $link['localized_options']['set_active_class'] = TRUE;
-
- $variables['link'] = [
- '#type' => 'link',
- '#title' => $link['title'],
- '#options' => $link['localized_options'],
- '#url' => $link['url'],
- ];
+ @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
+ \Drupal::service(MenuPreprocess::class)->preprocessMenuLocalAction($variables);
}
/**
diff --git a/core/lib/Drupal/Core/Breadcrumb/BreadcrumbPreprocess.php b/core/lib/Drupal/Core/Breadcrumb/BreadcrumbPreprocess.php
new file mode 100644
index 000000000000..4de3fde48a45
--- /dev/null
+++ b/core/lib/Drupal/Core/Breadcrumb/BreadcrumbPreprocess.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\Core\Breadcrumb;
+
+/**
+ * Breadcrumb theme preprocess.
+ *
+ * @internal
+ */
+class BreadcrumbPreprocess {
+
+ /**
+ * Prepares variables for breadcrumb templates.
+ *
+ * Default template: breadcrumb.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - links: A list of \Drupal\Core\Link objects which should be rendered.
+ */
+ public function preprocessBreadcrumb(array &$variables): void {
+ $variables['breadcrumb'] = [];
+ /** @var \Drupal\Core\Link $link */
+ foreach ($variables['links'] as $key => $link) {
+ $variables['breadcrumb'][$key] = [
+ 'text' => $link->getText(),
+ 'url' => $link->getUrl()->toString(),
+ ];
+ }
+ }
+
+}
diff --git a/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php b/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php
index 514cd9e9f550..13aa3dcf3f78 100644
--- a/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php
+++ b/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php
@@ -3,8 +3,10 @@
namespace Drupal\Core\DependencyInjection\Compiler;
use Drupal\Component\Utility\Reflection;
+use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;
@@ -178,7 +180,8 @@ class TaggedHandlersPass implements CompilerPassInterface {
foreach ($this->tagCache[$tag] ?? [] as $id => $attributes) {
// Validate the interface.
$handler = $container->getDefinition($id);
- if (!is_a($handler->getClass(), $interface, TRUE)) {
+ $class = $this->resolveDefinitionClass($handler, $container);
+ if (!is_a($class, $interface, TRUE)) {
throw new LogicException("Service '$id' for consumer '$consumer_id' does not implement $interface.");
}
$handlers[$id] = $attributes[0]['priority'] ?? 0;
@@ -249,4 +252,33 @@ class TaggedHandlersPass implements CompilerPassInterface {
$consumer->addArgument(array_keys($handlers));
}
+ /**
+ * Resolves the definition class.
+ *
+ * @param \Symfony\Component\DependencyInjection\Definition $definition
+ * The service definition.
+ * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
+ * The service container.
+ *
+ * @return class-string|null
+ * The resolved class-string or null if the class cannot be resolved.
+ */
+ protected function resolveDefinitionClass(Definition $definition, ContainerBuilder $container): ?string {
+ $class = $definition->getClass();
+ if ($class) {
+ return $class;
+ }
+
+ if (!$definition instanceof ChildDefinition) {
+ return NULL;
+ }
+
+ if (!$container->hasDefinition($definition->getParent())) {
+ return NULL;
+ }
+
+ $parent = $container->getDefinition($definition->getParent());
+ return $this->resolveDefinitionClass($parent, $container);
+ }
+
}
diff --git a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
index 30a2220777ee..ff3384063ef5 100644
--- a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
+++ b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php
@@ -204,9 +204,9 @@ interface QueryInterface extends AlterableInterface {
*
* @param array $headers
* An array of headers of the same structure as described in
- * template_preprocess_table(). Use a 'specifier' in place of a 'field' to
- * specify what to sort on. This can be an entity or a field as described
- * in condition().
+ * \Drupal\Core\Theme\ThemePreprocess::preprocessTable(). Use a 'specifier'
+ * in place of a 'field' to specify what to sort on. This can be an entity
+ * or a field as described in condition().
*
* @return $this
*/
diff --git a/core/lib/Drupal/Core/Menu/MenuPreprocess.php b/core/lib/Drupal/Core/Menu/MenuPreprocess.php
new file mode 100644
index 000000000000..a0834704c531
--- /dev/null
+++ b/core/lib/Drupal/Core/Menu/MenuPreprocess.php
@@ -0,0 +1,73 @@
+<?php
+
+namespace Drupal\Core\Menu;
+
+/**
+ * Menu theme preprocess.
+ *
+ * @internal
+ */
+class MenuPreprocess {
+
+ /**
+ * Prepares variables for single local task link templates.
+ *
+ * Default template: menu-local-task.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - element: A render element containing:
+ * - #link: A menu link array with 'title', 'url', and (optionally)
+ * 'localized_options' keys.
+ * - #active: A boolean indicating whether the local task is active.
+ */
+ public function preprocessMenuLocalTask(array &$variables): void {
+ $link = $variables['element']['#link'];
+ $link += [
+ 'localized_options' => [],
+ ];
+ $link_text = $link['title'];
+
+ if (!empty($variables['element']['#active'])) {
+ $variables['is_active'] = TRUE;
+ }
+
+ $link['localized_options']['set_active_class'] = TRUE;
+
+ $variables['link'] = [
+ '#type' => 'link',
+ '#title' => $link_text,
+ '#url' => $link['url'],
+ '#options' => $link['localized_options'],
+ ];
+ }
+
+ /**
+ * Prepares variables for single local action link templates.
+ *
+ * Default template: menu-local-action.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - element: A render element containing:
+ * - #link: A menu link array with 'title', 'url', and (optionally)
+ * 'localized_options' keys.
+ */
+ public function preprocessMenuLocalAction(array &$variables): void {
+ $link = $variables['element']['#link'];
+ $link += [
+ 'localized_options' => [],
+ ];
+ $link['localized_options']['attributes']['class'][] = 'button';
+ $link['localized_options']['attributes']['class'][] = 'button-action';
+ $link['localized_options']['set_active_class'] = TRUE;
+
+ $variables['link'] = [
+ '#type' => 'link',
+ '#title' => $link['title'],
+ '#options' => $link['localized_options'],
+ '#url' => $link['url'],
+ ];
+ }
+
+}
diff --git a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
index 0c63ce2ac495..5ce90c946550 100644
--- a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
+++ b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
@@ -88,7 +88,8 @@ class BareHtmlPageRenderer implements BareHtmlPageRendererInterface {
* The page to attach to.
*/
public function systemPageAttachments(array &$page): void {
- // Ensure the same CSS is loaded in template_preprocess_maintenance_page().
+ // Ensure the same CSS is loaded in
+ // \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage().
$page['#attached']['library'][] = 'system/base';
if (\Drupal::service('router.admin_context')->isAdminRoute()) {
$page['#attached']['library'][] = 'system/admin';
diff --git a/core/lib/Drupal/Core/Render/Element/Table.php b/core/lib/Drupal/Core/Render/Element/Table.php
index c9af86146829..957b868ed63e 100644
--- a/core/lib/Drupal/Core/Render/Element/Table.php
+++ b/core/lib/Drupal/Core/Render/Element/Table.php
@@ -402,7 +402,7 @@ class Table extends FormElementBase {
* @return array
* Associative array of rendered child elements for a table.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
* @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
* @see drupal_attach_tabledrag()
*/
diff --git a/core/lib/Drupal/Core/Theme/ImagePreprocess.php b/core/lib/Drupal/Core/Theme/ImagePreprocess.php
new file mode 100644
index 000000000000..2f43ffe4c089
--- /dev/null
+++ b/core/lib/Drupal/Core/Theme/ImagePreprocess.php
@@ -0,0 +1,90 @@
+<?php
+
+namespace Drupal\Core\Theme;
+
+use Drupal\Core\File\FileUrlGeneratorInterface;
+use Drupal\Core\Template\AttributeHelper;
+
+/**
+ * Image theme preprocess.
+ *
+ * @internal
+ */
+class ImagePreprocess {
+
+ public function __construct(protected FileUrlGeneratorInterface $fileUrlGenerator) {
+ }
+
+ /**
+ * Prepares variables for image templates.
+ *
+ * Default template: image.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - uri: Either the path of the image file (relative to base_path()) or a
+ * full URL.
+ * - width: The width of the image (if known).
+ * - height: The height of the image (if known).
+ * - alt: The alternative text for text-based browsers. HTML 4 and XHTML 1.0
+ * always require an alt attribute. The HTML 5 draft allows the alt
+ * attribute to be omitted in some cases. Therefore, this variable
+ * defaults to an empty string, but can be set to NULL for the attribute
+ * to be omitted. Usually, neither omission nor an empty string satisfies
+ * accessibility requirements, so it is strongly encouraged for code
+ * building variables for image.html.twig templates to pass a meaningful
+ * value for this variable.
+ * - https://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8
+ * - https://www.w3.org/TR/xhtml1/dtds.html
+ * - http://dev.w3.org/html5/spec/Overview.html#alt
+ * - title: The title text is displayed when the image is hovered in some
+ * popular browsers.
+ * - attributes: Associative array of attributes to be placed in the img
+ * tag.
+ * - srcset: Array of multiple URIs and sizes/multipliers.
+ * - sizes: The sizes attribute for viewport-based selection of images.
+ * phpcs:ignore
+ * - http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content.html#introduction-3:viewport-based-selection-2
+ */
+ public function preprocessImage(array &$variables): void {
+ if (!empty($variables['uri'])) {
+ $variables['attributes']['src'] = $this->fileUrlGenerator->generateString($variables['uri']);
+ }
+ // Generate a srcset attribute conforming to the spec at
+ // https://www.w3.org/html/wg/drafts/html/master/embedded-content.html#attr-img-srcset
+ if (!empty($variables['srcset'])) {
+ $srcset = [];
+ foreach ($variables['srcset'] as $src) {
+ // URI is mandatory.
+ $source = $this->fileUrlGenerator->generateString($src['uri']);
+ if (isset($src['width']) && !empty($src['width'])) {
+ $source .= ' ' . $src['width'];
+ }
+ elseif (isset($src['multiplier']) && !empty($src['multiplier'])) {
+ $source .= ' ' . $src['multiplier'];
+ }
+ $srcset[] = $source;
+ }
+ $variables['attributes']['srcset'] = implode(', ', $srcset);
+ }
+
+ foreach (['width', 'height', 'alt', 'title', 'sizes'] as $key) {
+ if (isset($variables[$key])) {
+ // If the property has already been defined in the attributes,
+ // do not override, including NULL.
+ if (AttributeHelper::attributeExists($key, $variables['attributes'])) {
+ continue;
+ }
+ $variables['attributes'][$key] = $variables[$key];
+ }
+ }
+
+ // Without dimensions specified, layout shifts can occur,
+ // which are more noticeable on pages that take some time to load.
+ // As a result, only mark images as lazy load that have dimensions.
+ if (isset($variables['width'], $variables['height']) && !isset($variables['attributes']['loading'])) {
+ $variables['attributes']['loading'] = 'lazy';
+ }
+ }
+
+}
diff --git a/core/lib/Drupal/Core/Theme/ThemeCommonElements.php b/core/lib/Drupal/Core/Theme/ThemeCommonElements.php
index 0d5e7c6638a5..50755c302a70 100644
--- a/core/lib/Drupal/Core/Theme/ThemeCommonElements.php
+++ b/core/lib/Drupal/Core/Theme/ThemeCommonElements.php
@@ -4,8 +4,10 @@ declare(strict_types=1);
namespace Drupal\Core\Theme;
+use Drupal\Core\Breadcrumb\BreadcrumbPreprocess;
use Drupal\Core\Datetime\DatePreprocess;
use Drupal\Core\Field\FieldPreprocess;
+use Drupal\Core\Menu\MenuPreprocess;
use Drupal\Core\Pager\PagerPreprocess;
/**
@@ -36,6 +38,7 @@ class ThemeCommonElements {
],
'region' => [
'render element' => 'elements',
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessRegion',
],
'time' => [
'variables' => [
@@ -100,11 +103,13 @@ class ThemeCommonElements {
'srcset' => [],
'style_name' => NULL,
],
+ 'initial preprocess' => ImagePreprocess::class . ':preprocessImage',
],
'breadcrumb' => [
'variables' => [
'links' => [],
],
+ 'initial preprocess' => BreadcrumbPreprocess::class . ':preprocessBreadcrumb',
],
'table' => [
'variables' => [
@@ -118,11 +123,13 @@ class ThemeCommonElements {
'responsive' => TRUE,
'empty' => '',
],
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessTable',
],
'tablesort_indicator' => [
'variables' => [
'style' => NULL,
],
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessTablesortIndicator',
],
'mark' => [
'variables' => [
@@ -139,6 +146,7 @@ class ThemeCommonElements {
'empty' => NULL,
'context' => [],
],
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessItemList',
],
'feed_icon' => [
'variables' => [
@@ -157,12 +165,13 @@ class ThemeCommonElements {
'indentation' => [
'variables' => ['size' => 1],
],
- // From theme.maintenance.inc.
'maintenance_page' => [
'render element' => 'page',
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessMaintenancePage',
],
'install_page' => [
'render element' => 'page',
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessInstallPage',
],
'maintenance_task_list' => [
'variables' => [
@@ -170,6 +179,7 @@ class ThemeCommonElements {
'active' => NULL,
'variant' => NULL,
],
+ 'initial preprocess' => ThemePreprocess::class . ':preprocessMaintenanceTaskList',
],
'authorize_report' => [
'variables' => [
@@ -193,9 +203,11 @@ class ThemeCommonElements {
],
'menu_local_task' => [
'render element' => 'element',
+ 'initial preprocess' => MenuPreprocess::class . ':preprocessMenuLocalTask',
],
'menu_local_action' => [
'render element' => 'element',
+ 'initial preprocess' => MenuPreprocess::class . ':preprocessMenuLocalAction',
],
'menu_local_tasks' => [
'variables' => [
diff --git a/core/lib/Drupal/Core/Theme/ThemePreprocess.php b/core/lib/Drupal/Core/Theme/ThemePreprocess.php
index 2a93d5b06c91..f712e3d9ff98 100644
--- a/core/lib/Drupal/Core/Theme/ThemePreprocess.php
+++ b/core/lib/Drupal/Core/Theme/ThemePreprocess.php
@@ -5,15 +5,18 @@ namespace Drupal\Core\Theme;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Installer\InstallerKernel;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Path\CurrentPathStack;
use Drupal\Core\Path\PathMatcherInterface;
+use Drupal\Core\Render\Element;
use Drupal\Core\Render\Markup;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
+use Drupal\Core\Utility\TableSort;
/**
* Preprocess for common/core theme templates.
@@ -356,4 +359,445 @@ class ThemePreprocess {
}
}
+ /**
+ * Prepares variables for maintenance page templates.
+ *
+ * Default template: maintenance-page.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - content - An array of page content.
+ *
+ * @see system_page_attachments()
+ */
+ public function preprocessMaintenancePage(array &$variables): void {
+ // @todo Rename the templates to page--maintenance + page--install.
+ $this->preprocessPage($variables);
+
+ // @see system_page_attachments()
+ $variables['#attached']['library'][] = 'system/maintenance';
+
+ // Maintenance page and install page need branding info in variables because
+ // there is no blocks.
+ $site_config = $this->configFactory->get('system.site');
+ $variables['logo'] = theme_get_setting('logo.url');
+ $variables['site_name'] = $site_config->get('name');
+ $variables['site_slogan'] = $site_config->get('slogan');
+
+ // Maintenance page and install page need page title in variable because
+ // there are no blocks.
+ $variables['title'] = $variables['page']['#title'];
+ }
+
+ /**
+ * Prepares variables for install page templates.
+ *
+ * Default template: install-page.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - content - An array of page content.
+ *
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
+ */
+ public function preprocessInstallPage(array &$variables): void {
+ $installer_active_task = NULL;
+ if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install' && InstallerKernel::installationAttempted()) {
+ $installer_active_task = $GLOBALS['install_state']['active_task'];
+ }
+
+ $this->preprocessMaintenancePage($variables);
+
+ // Override the site name that is displayed on the page, since Drupal is
+ // still in the process of being installed.
+ $distribution_name = drupal_install_profile_distribution_name();
+ $variables['site_name'] = $distribution_name;
+ $variables['site_version'] = $installer_active_task ? drupal_install_profile_distribution_version() : '';
+ }
+
+ /**
+ * Prepares variables for region templates.
+ *
+ * Default template: region.html.twig.
+ *
+ * Prepares the values passed to the theme_region function to be passed into a
+ * pluggable template engine. Uses the region name to generate a template file
+ * suggestions.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - elements: An associative array containing properties of the region.
+ */
+ public function preprocessRegion(array &$variables): void {
+ // Create the $content variable that templates expect.
+ $variables['content'] = $variables['elements']['#children'];
+ $variables['region'] = $variables['elements']['#region'];
+ }
+
+ /**
+ * Prepares variables for table templates.
+ *
+ * Default template: table.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - header: An array containing the table headers. Each element of the
+ * array can be either a localized string or an associative array with the
+ * following keys:
+ * - data: The localized title of the table column, as a string or render
+ * array.
+ * - field: The database field represented in the table column (required
+ * if user is to be able to sort on this column).
+ * - sort: A default sort order for this column ("asc" or "desc"). Only
+ * one column should be given a default sort order because table sorting
+ * only applies to one column at a time.
+ * - initial_click_sort: Set the initial sort of the column when clicked.
+ * Defaults to "asc".
+ * - class: An array of values for the 'class' attribute. In particular,
+ * the least important columns that can be hidden on narrow and medium
+ * width screens should have a 'priority-low' class, referenced with the
+ * RESPONSIVE_PRIORITY_LOW constant. Columns that should be shown on
+ * medium+ wide screens should be marked up with a class of
+ * 'priority-medium', referenced by with the RESPONSIVE_PRIORITY_MEDIUM
+ * constant. Themes may hide columns with one of these two classes on
+ * narrow viewports to save horizontal space.
+ * - Any HTML attributes, such as "colspan", to apply to the column header
+ * cell.
+ * - rows: An array of table rows. Every row is an array of cells, or an
+ * associative array with the following keys:
+ * - data: An array of cells.
+ * - Any HTML attributes, such as "class", to apply to the table row.
+ * - no_striping: A Boolean indicating that the row should receive no
+ * 'even / odd' styling. Defaults to FALSE.
+ * Each cell can be either a string or an associative array with the
+ * following keys:
+ * - data: The string or render array to display in the table cell.
+ * - header: Indicates this cell is a header.
+ * - Any HTML attributes, such as "colspan", to apply to the table cell.
+ * Here's an example for $rows:
+ * @code
+ * $rows = [
+ * // Simple row
+ * [
+ * 'Cell 1', 'Cell 2', 'Cell 3'
+ * ],
+ * // Row with attributes on the row and some of its cells.
+ * [
+ * 'data' => ['Cell 1', ['data' => 'Cell 2', 'colspan' => 2]], 'class' => ['funky']
+ * ],
+ * ];
+ * @endcode
+ * - footer: An array of table rows which will be printed within a <tfoot>
+ * tag, in the same format as the rows element (see above).
+ * - attributes: An array of HTML attributes to apply to the table tag.
+ * - caption: A localized string to use for the <caption> tag.
+ * - colgroups: An array of column groups. Each element of the array can be
+ * either:
+ * - An array of columns, each of which is an associative array of HTML
+ * attributes applied to the <col> element.
+ * - An array of attributes applied to the <colgroup> element, which must
+ * include a "data" attribute. To add attributes to <col> elements,
+ * set the "data" attribute with an array of columns, each of which is
+ * an associative array of HTML attributes.
+ * Here's an example for $colgroup:
+ * @code
+ * $colgroup = [
+ * // <colgroup> with one <col> element.
+ * [
+ * [
+ * 'class' => ['funky'], // Attribute for the <col> element.
+ * ],
+ * ],
+ * // <colgroup> with attributes and inner <col> elements.
+ * [
+ * 'data' => [
+ * [
+ * 'class' => ['funky'], // Attribute for the <col> element.
+ * ],
+ * ],
+ * 'class' => ['jazzy'], // Attribute for the <colgroup> element.
+ * ],
+ * ];
+ * @endcode
+ * These optional tags are used to group and set properties on columns
+ * within a table. For example, one may easily group three columns and
+ * apply same background style to all.
+ * - sticky: Use a "sticky" table header.
+ * - empty: The message to display in an extra row if table does not have
+ * any rows.
+ */
+ public function preprocessTable(array &$variables): void {
+ // Format the table columns:
+ if (!empty($variables['colgroups'])) {
+ foreach ($variables['colgroups'] as &$colgroup) {
+ // Check if we're dealing with a simple or complex column
+ if (isset($colgroup['data'])) {
+ $cols = $colgroup['data'];
+ unset($colgroup['data']);
+ $colgroup_attributes = $colgroup;
+ }
+ else {
+ $cols = $colgroup;
+ $colgroup_attributes = [];
+ }
+ $colgroup = [];
+ $colgroup['attributes'] = new Attribute($colgroup_attributes);
+ $colgroup['cols'] = [];
+
+ // Build columns.
+ if (is_array($cols) && !empty($cols)) {
+ foreach ($cols as $col_key => $col) {
+ $colgroup['cols'][$col_key]['attributes'] = new Attribute($col);
+ }
+ }
+ }
+ }
+
+ // Build an associative array of responsive classes keyed by column.
+ $responsive_classes = [];
+
+ // Format the table header:
+ $ts = [];
+ $header_columns = 0;
+ if (!empty($variables['header'])) {
+ $ts = TableSort::getContextFromRequest($variables['header'], \Drupal::request());
+
+ // Use a separate index with responsive classes as headers
+ // may be associative.
+ $responsive_index = -1;
+ foreach ($variables['header'] as $col_key => $cell) {
+ // Increase the responsive index.
+ $responsive_index++;
+
+ if (!is_array($cell)) {
+ $header_columns++;
+ $cell_content = $cell;
+ $cell_attributes = new Attribute();
+ $is_header = TRUE;
+ }
+ else {
+ if (isset($cell['colspan'])) {
+ $header_columns += $cell['colspan'];
+ }
+ else {
+ $header_columns++;
+ }
+ $cell_content = '';
+ if (isset($cell['data'])) {
+ $cell_content = $cell['data'];
+ unset($cell['data']);
+ }
+ // Flag the cell as a header or not and remove the flag.
+ $is_header = $cell['header'] ?? TRUE;
+ unset($cell['header']);
+
+ // Track responsive classes for each column as needed. Only the header
+ // cells for a column are marked up with the responsive classes by a
+ // module developer or themer. The responsive classes on the header
+ // cells must be transferred to the content cells.
+ if (!empty($cell['class']) && is_array($cell['class'])) {
+ if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) {
+ $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_MEDIUM;
+ }
+ elseif (in_array(RESPONSIVE_PRIORITY_LOW, $cell['class'])) {
+ $responsive_classes[$responsive_index] = RESPONSIVE_PRIORITY_LOW;
+ }
+ }
+
+ TableSort::header($cell_content, $cell, $variables['header'], $ts);
+
+ // TableSort::header() removes the 'sort', 'initial_click_sort' and
+ // 'field' keys.
+ $cell_attributes = new Attribute($cell);
+ }
+ $variables['header'][$col_key] = [];
+ $variables['header'][$col_key]['tag'] = $is_header ? 'th' : 'td';
+ $variables['header'][$col_key]['attributes'] = $cell_attributes;
+ $variables['header'][$col_key]['content'] = $cell_content;
+ }
+ }
+ $variables['header_columns'] = $header_columns;
+
+ // Rows and footer have the same structure.
+ $sections = ['rows' , 'footer'];
+ foreach ($sections as $section) {
+ if (!empty($variables[$section])) {
+ foreach ($variables[$section] as $row_key => $row) {
+ $cells = $row;
+ $row_attributes = [];
+
+ // Check if we're dealing with a simple or complex row
+ if (isset($row['data'])) {
+ $cells = $row['data'];
+ $variables['no_striping'] = $row['no_striping'] ?? FALSE;
+
+ // Set the attributes array and exclude 'data' and 'no_striping'.
+ $row_attributes = $row;
+ unset($row_attributes['data']);
+ unset($row_attributes['no_striping']);
+ }
+
+ // Build row.
+ $variables[$section][$row_key] = [];
+ $variables[$section][$row_key]['attributes'] = new Attribute($row_attributes);
+ $variables[$section][$row_key]['cells'] = [];
+ if (!empty($cells)) {
+ // Reset the responsive index.
+ $responsive_index = -1;
+ foreach ($cells as $col_key => $cell) {
+ // Increase the responsive index.
+ $responsive_index++;
+
+ if (!is_array($cell)) {
+ $cell_content = $cell;
+ $cell_attributes = [];
+ $is_header = FALSE;
+ }
+ else {
+ $cell_content = '';
+ if (isset($cell['data'])) {
+ $cell_content = $cell['data'];
+ unset($cell['data']);
+ }
+
+ // Flag the cell as a header or not and remove the flag.
+ $is_header = !empty($cell['header']);
+ unset($cell['header']);
+
+ $cell_attributes = $cell;
+ }
+ // Active table sort information.
+ if (isset($variables['header'][$col_key]['data']) && $variables['header'][$col_key]['data'] == $ts['name'] && !empty($variables['header'][$col_key]['field'])) {
+ $variables[$section][$row_key]['cells'][$col_key]['active_table_sort'] = TRUE;
+ }
+ // Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM
+ // class from header to cell as needed.
+ if (isset($responsive_classes[$responsive_index])) {
+ $cell_attributes['class'][] = $responsive_classes[$responsive_index];
+ }
+ $variables[$section][$row_key]['cells'][$col_key]['tag'] = $is_header ? 'th' : 'td';
+ $variables[$section][$row_key]['cells'][$col_key]['attributes'] = new Attribute($cell_attributes);
+ $variables[$section][$row_key]['cells'][$col_key]['content'] = $cell_content;
+ }
+ }
+ }
+ }
+ }
+ if (empty($variables['no_striping'])) {
+ $variables['attributes']['data-striping'] = 1;
+ }
+ }
+
+ /**
+ * Prepares variables for tablesort indicators.
+ *
+ * Default template: tablesort-indicator.html.twig.
+ */
+ public function preprocessTablesortIndicator(array &$variables): void {
+ $variables['#attached']['library'][] = 'core/drupal.tablesort';
+ }
+
+ /**
+ * Prepares variables for item list templates.
+ *
+ * Default template: item-list.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - items: An array of items to be displayed in the list. Each item can be
+ * either a string or a render array. If #type, #theme, or #markup
+ * properties are not specified for child render arrays, they will be
+ * inherited from the parent list, allowing callers to specify larger
+ * nested lists without having to explicitly specify and repeat the
+ * render properties for all nested child lists.
+ * - title: A title to be prepended to the list.
+ * - list_type: The type of list to return (e.g. "ul", "ol").
+ * - wrapper_attributes: HTML attributes to be applied to the list wrapper.
+ *
+ * @see https://www.drupal.org/node/1842756
+ */
+ public function preprocessItemList(array &$variables): void {
+ $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);
+ $variables['#attached']['library'][] = 'core/drupal.item-list';
+ foreach ($variables['items'] as &$item) {
+ $attributes = [];
+ // If the item value is an array, then it is a render array.
+ if (is_array($item)) {
+ // List items support attributes via the '#wrapper_attributes' property.
+ if (isset($item['#wrapper_attributes'])) {
+ $attributes = $item['#wrapper_attributes'];
+ }
+ // Determine whether there are any child elements in the item that are
+ // not fully-specified render arrays. If there are any, then the child
+ // elements present nested lists and we automatically inherit the render
+ // array properties of the current list to them.
+ foreach (Element::children($item) as $key) {
+ $child = &$item[$key];
+ // If this child element does not specify how it can be rendered, then
+ // we need to inherit the render properties of the current list.
+ if (!isset($child['#type']) && !isset($child['#theme']) && !isset($child['#markup'])) {
+ // Since item-list.html.twig supports both strings and render arrays
+ // as items, the items of the nested list may have been specified as
+ // the child elements of the nested list, instead of #items. For
+ // convenience, we automatically move them into #items.
+ if (!isset($child['#items'])) {
+ // This is the same condition as in
+ // \Drupal\Core\Render\Element::children(), which cannot be used
+ // here, since it triggers an error on string values.
+ foreach ($child as $child_key => $child_value) {
+ if (is_int($child_key) || $child_key === '' || $child_key[0] !== '#') {
+ $child['#items'][$child_key] = $child_value;
+ unset($child[$child_key]);
+ }
+ }
+ }
+ // Lastly, inherit the original theme variables of the current list.
+ $child['#theme'] = $variables['theme_hook_original'];
+ $child['#list_type'] = $variables['list_type'];
+ }
+ }
+ }
+
+ // Set the item's value and attributes for the template.
+ $item = [
+ 'value' => $item,
+ 'attributes' => new Attribute($attributes),
+ ];
+ }
+ }
+
+ /**
+ * Prepares variables for maintenance task list templates.
+ *
+ * Default template: maintenance-task-list.html.twig.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - items: An associative array of maintenance tasks.
+ * It's the caller's responsibility to ensure this array's items contain
+ * no dangerous HTML such as <script> tags.
+ * - active: The key for the currently active maintenance task.
+ */
+ public function preprocessMaintenanceTaskList(array &$variables): void {
+ $items = $variables['items'];
+ $active = $variables['active'];
+
+ $done = isset($items[$active]) || $active == NULL;
+ foreach ($items as $k => $item) {
+ $variables['tasks'][$k]['item'] = $item;
+ $variables['tasks'][$k]['attributes'] = new Attribute();
+ if ($active == $k) {
+ $variables['tasks'][$k]['attributes']->addClass('is-active');
+ $variables['tasks'][$k]['status'] = $this->t('active');
+ $done = FALSE;
+ }
+ else {
+ if ($done) {
+ $variables['tasks'][$k]['attributes']->addClass('done');
+ $variables['tasks'][$k]['status'] = $this->t('done');
+ }
+ }
+ }
+ }
+
}
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index 8904dd925e57..67c049fa5057 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -5,6 +5,7 @@
*/
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Theme\ThemePreprocess;
use Drupal\field_ui\FieldUI;
/**
@@ -18,7 +19,7 @@ use Drupal\field_ui\FieldUI;
* rendered as a table.
*/
function template_preprocess_field_ui_table(&$variables): void {
- template_preprocess_table($variables);
+ \Drupal::service(ThemePreprocess::class)->preprocessTable($variables);
}
/**
diff --git a/core/modules/mysqli/mysqli.install b/core/modules/mysqli/mysqli.install
deleted file mode 100644
index 7f1147d63adb..000000000000
--- a/core/modules/mysqli/mysqli.install
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * @file
- * Install, update and uninstall functions for the mysqli module.
- */
-
-use Drupal\Core\Database\Database;
-use Drupal\Core\Extension\Requirement\RequirementSeverity;
-use Drupal\Core\Render\Markup;
-
-/**
- * Implements hook_requirements().
- */
-function mysqli_requirements($phase): array {
- $requirements = [];
-
- if ($phase === 'runtime') {
- // Test with MySql databases.
- if (Database::isActiveConnection()) {
- $connection = Database::getConnection();
- // Only show requirements when MySQLi is the default database connection.
- if (!($connection->driver() === 'mysqli' && $connection->getProvider() === 'mysqli')) {
- return [];
- }
-
- $query = $connection->isMariaDb() ? 'SELECT @@SESSION.tx_isolation' : 'SELECT @@SESSION.transaction_isolation';
-
- $isolation_level = $connection->query($query)->fetchField();
-
- $tables_missing_primary_key = [];
- $tables = $connection->schema()->findTables('%');
- foreach ($tables as $table) {
- $primary_key_column = Database::getConnection()->query("SHOW KEYS FROM {" . $table . "} WHERE Key_name = 'PRIMARY'")->fetchAllAssoc('Column_name');
- if (empty($primary_key_column)) {
- $tables_missing_primary_key[] = $table;
- }
- }
-
- $description = [];
- if ($isolation_level == 'READ-COMMITTED') {
- if (empty($tables_missing_primary_key)) {
- $severity_level = RequirementSeverity::OK;
- }
- else {
- $severity_level = RequirementSeverity::Error;
- }
- }
- else {
- if ($isolation_level == 'REPEATABLE-READ') {
- $severity_level = RequirementSeverity::Warning;
- }
- else {
- $severity_level = RequirementSeverity::Error;
- $description[] = t('This is not supported by Drupal.');
- }
- $description[] = t('The recommended level for Drupal is "READ COMMITTED".');
- }
-
- if (!empty($tables_missing_primary_key)) {
- $description[] = t('For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: @tables.', ['@tables' => implode(', ', $tables_missing_primary_key)]);
- }
-
- $description[] = t('See the <a href=":performance_doc">setting MySQL transaction isolation level</a> page for more information.', [
- ':performance_doc' => 'https://www.drupal.org/docs/system-requirements/setting-the-mysql-transaction-isolation-level',
- ]);
-
- $requirements['mysql_transaction_level'] = [
- 'title' => t('Transaction isolation level'),
- 'severity' => $severity_level,
- 'value' => $isolation_level,
- 'description' => Markup::create(implode(' ', $description)),
- ];
- }
- }
-
- return $requirements;
-}
diff --git a/core/modules/mysqli/src/Hook/MysqliHooks.php b/core/modules/mysqli/src/Hook/MysqliHooks.php
index 5fae187d16c7..340b17373a12 100644
--- a/core/modules/mysqli/src/Hook/MysqliHooks.php
+++ b/core/modules/mysqli/src/Hook/MysqliHooks.php
@@ -2,7 +2,10 @@
namespace Drupal\mysqli\Hook;
+use Drupal\Core\Database\Database;
+use Drupal\Core\Extension\Requirement\RequirementSeverity;
use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\Render\Markup;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
@@ -29,4 +32,71 @@ class MysqliHooks {
return NULL;
}
+ /**
+ * Implements hook_runtime_requirements().
+ */
+ #[Hook('runtime_requirements')]
+ public function runtimeRequirements(): array {
+ $requirements = [];
+
+ // Test with MySql databases.
+ if (Database::isActiveConnection()) {
+ $connection = Database::getConnection();
+ // Only show requirements when MySQLi is the default database connection.
+ if (!($connection->driver() === 'mysqli' && $connection->getProvider() === 'mysqli')) {
+ return [];
+ }
+
+ $query = $connection->isMariaDb() ? 'SELECT @@SESSION.tx_isolation' : 'SELECT @@SESSION.transaction_isolation';
+
+ $isolation_level = $connection->query($query)->fetchField();
+
+ $tables_missing_primary_key = [];
+ $tables = $connection->schema()->findTables('%');
+ foreach ($tables as $table) {
+ $primary_key_column = Database::getConnection()->query("SHOW KEYS FROM {" . $table . "} WHERE Key_name = 'PRIMARY'")->fetchAllAssoc('Column_name');
+ if (empty($primary_key_column)) {
+ $tables_missing_primary_key[] = $table;
+ }
+ }
+
+ $description = [];
+ if ($isolation_level == 'READ-COMMITTED') {
+ if (empty($tables_missing_primary_key)) {
+ $severity_level = RequirementSeverity::OK;
+ }
+ else {
+ $severity_level = RequirementSeverity::Error;
+ }
+ }
+ else {
+ if ($isolation_level == 'REPEATABLE-READ') {
+ $severity_level = RequirementSeverity::Warning;
+ }
+ else {
+ $severity_level = RequirementSeverity::Error;
+ $description[] = $this->t('This is not supported by Drupal.');
+ }
+ $description[] = $this->t('The recommended level for Drupal is "READ COMMITTED".');
+ }
+
+ if (!empty($tables_missing_primary_key)) {
+ $description[] = $this->t('For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: @tables.', ['@tables' => implode(', ', $tables_missing_primary_key)]);
+ }
+
+ $description[] = $this->t('See the <a href=":performance_doc">setting MySQL transaction isolation level</a> page for more information.', [
+ ':performance_doc' => 'https://www.drupal.org/docs/system-requirements/setting-the-mysql-transaction-isolation-level',
+ ]);
+
+ $requirements['mysql_transaction_level'] = [
+ 'title' => $this->t('Transaction isolation level'),
+ 'severity' => $severity_level,
+ 'value' => $isolation_level,
+ 'description' => Markup::create(implode(' ', $description)),
+ ];
+ }
+
+ return $requirements;
+ }
+
}
diff --git a/core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php b/core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php
index 18c87b11956b..4cc4405d4c81 100644
--- a/core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php
+++ b/core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php
@@ -4,13 +4,15 @@ declare(strict_types=1);
namespace Drupal\Tests\package_manager\Build;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests installing packages in a stage directory.
*
- * @group package_manager
- * @group #slow
* @internal
*/
+#[Group('package_manager')]
+#[Group('#slow')]
class PackageInstallSubmoduleTest extends TemplateProjectTestBase {
/**
diff --git a/core/modules/package_manager/tests/src/Build/PackageInstallTest.php b/core/modules/package_manager/tests/src/Build/PackageInstallTest.php
index 362343eaa91a..283c6aefa2cf 100644
--- a/core/modules/package_manager/tests/src/Build/PackageInstallTest.php
+++ b/core/modules/package_manager/tests/src/Build/PackageInstallTest.php
@@ -4,13 +4,15 @@ declare(strict_types=1);
namespace Drupal\Tests\package_manager\Build;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests installing packages in a stage directory.
*
- * @group package_manager
- * @group #slow
* @internal
*/
+#[Group('package_manager')]
+#[Group('#slow')]
class PackageInstallTest extends TemplateProjectTestBase {
/**
diff --git a/core/modules/package_manager/tests/src/Build/PackageUpdateTest.php b/core/modules/package_manager/tests/src/Build/PackageUpdateTest.php
index 2b9ef4aa894e..da6fc5eae320 100644
--- a/core/modules/package_manager/tests/src/Build/PackageUpdateTest.php
+++ b/core/modules/package_manager/tests/src/Build/PackageUpdateTest.php
@@ -5,14 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\package_manager\Build;
use Drupal\package_manager_test_api\ControllerSandboxManager;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests updating packages in a stage directory.
*
- * @group package_manager
- * @group #slow
* @internal
*/
+#[Group('package_manager')]
+#[Group('#slow')]
class PackageUpdateTest extends TemplateProjectTestBase {
/**
diff --git a/core/modules/system/src/Hook/PageAttachmentsHook.php b/core/modules/system/src/Hook/PageAttachmentsHook.php
index fb6335f90c31..3f271571ede1 100644
--- a/core/modules/system/src/Hook/PageAttachmentsHook.php
+++ b/core/modules/system/src/Hook/PageAttachmentsHook.php
@@ -19,7 +19,7 @@ final class PageAttachmentsHook {
/**
* Implements hook_page_attachments().
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
* @see \Drupal\Core\EventSubscriber\ActiveLinkResponseFilter
*/
#[Hook('page_attachments')]
diff --git a/core/modules/system/templates/image.html.twig b/core/modules/system/templates/image.html.twig
index 6411eaa3d07b..1f6d19d6c3e7 100644
--- a/core/modules/system/templates/image.html.twig
+++ b/core/modules/system/templates/image.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the img tag.
* - style_name: (optional) The name of the image style applied.
*
- * @see template_preprocess_image()
+ * @see \Drupal\Core\Theme\ImagePreprocess::preprocessImage()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/install-page.html.twig b/core/modules/system/templates/install-page.html.twig
index f6091fd3b956..d9144e6a154b 100644
--- a/core/modules/system/templates/install-page.html.twig
+++ b/core/modules/system/templates/install-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_install_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessInstallPage()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/item-list.html.twig b/core/modules/system/templates/item-list.html.twig
index 1462cf41ae0f..c2babdab978e 100644
--- a/core/modules/system/templates/item-list.html.twig
+++ b/core/modules/system/templates/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/maintenance-page.html.twig b/core/modules/system/templates/maintenance-page.html.twig
index 748ed5a3aa4a..06fb6065f7a4 100644
--- a/core/modules/system/templates/maintenance-page.html.twig
+++ b/core/modules/system/templates/maintenance-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/menu-local-action.html.twig b/core/modules/system/templates/menu-local-action.html.twig
index 0eb03a9534ab..e0280d5fcbc0 100644
--- a/core/modules/system/templates/menu-local-action.html.twig
+++ b/core/modules/system/templates/menu-local-action.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the wrapper element.
* - link: A rendered link element.
*
- * @see template_preprocess_menu_local_action()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalAction()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/menu-local-task.html.twig b/core/modules/system/templates/menu-local-task.html.twig
index ec02a8d530c4..b2a743940a77 100644
--- a/core/modules/system/templates/menu-local-task.html.twig
+++ b/core/modules/system/templates/menu-local-task.html.twig
@@ -11,7 +11,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/region.html.twig b/core/modules/system/templates/region.html.twig
index 219e14b0a4be..ddcaaa192df4 100644
--- a/core/modules/system/templates/region.html.twig
+++ b/core/modules/system/templates/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*
* @ingroup themeable
*/
diff --git a/core/modules/system/templates/table.html.twig b/core/modules/system/templates/table.html.twig
index cfcb0bf976c0..6a73cc1152a8 100644
--- a/core/modules/system/templates/table.html.twig
+++ b/core/modules/system/templates/table.html.twig
@@ -38,7 +38,7 @@
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
*
* @ingroup themeable
*/
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
index e9928fd77660..4940f047477e 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list--search-results.html.twig
@@ -17,7 +17,7 @@
* results, the following data is set:
* - plugin: The search plugin ID, for example "node_search".
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{%
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list.html.twig
index 20541b0b7e66..6e7b8e317b1d 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if context.list_style %}
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/table.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/table.html.twig
index cdfe0bff7e73..d7e6459bd4a4 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/dataset/table.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/dataset/table.html.twig
@@ -38,7 +38,7 @@
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
*/
#}
<table{{ attributes }}>
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
index 31f782bb60a8..90d955c180a6 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/field/image.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the img tag.
* - style_name: (optional) The name of the image style applied.
*
- * @see template_preprocess_image()
+ * @see \Drupal\Core\Theme\ImagePreprocess::preprocessImage()
*/
#}
{%
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/layout/maintenance-page.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/layout/maintenance-page.html.twig
index 7463b0238ca3..edd2783619b8 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/layout/maintenance-page.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/layout/maintenance-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*/
#}
<div class="layout-container">
diff --git a/core/profiles/demo_umami/themes/umami/templates/classy/layout/region.html.twig b/core/profiles/demo_umami/themes/umami/templates/classy/layout/region.html.twig
index 95e71cec37e4..a4e8cc0af72a 100644
--- a/core/profiles/demo_umami/themes/umami/templates/classy/layout/region.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/classy/layout/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/profiles/demo_umami/themes/umami/templates/components/navigation/menu-local-task.html.twig b/core/profiles/demo_umami/themes/umami/templates/components/navigation/menu-local-task.html.twig
index b1d11d5458c5..99122f1668e0 100644
--- a/core/profiles/demo_umami/themes/umami/templates/components/navigation/menu-local-task.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/components/navigation/menu-local-task.html.twig
@@ -11,7 +11,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*/
#}
<li{{ attributes.addClass('tabs__tab', is_active ? 'is-active') }}>{{ link }}</li>
diff --git a/core/profiles/demo_umami/themes/umami/templates/layout/region--header.html.twig b/core/profiles/demo_umami/themes/umami/templates/layout/region--header.html.twig
index a0b90e94cb6c..d55f70c54ae9 100644
--- a/core/profiles/demo_umami/themes/umami/templates/layout/region--header.html.twig
+++ b/core/profiles/demo_umami/themes/umami/templates/layout/region--header.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
index d1c07c20124e..1211cfb351b7 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests Ajax callbacks on FAPI elements.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxCallbacksTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
index b2ae9386bd0a..1eff2c19bbee 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the usage of form caching for AJAX forms.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxFormCacheTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
index c9a4b3ef2722..347e8ac86f1a 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the Ajax image buttons work with key press events.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxFormImageButtonTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
index a80a627a89cc..c11430fdebff 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Performs tests on AJAX forms in cached pages.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxFormPageCacheTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php
index a8282b2b6cfe..6618ec6acede 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that form elements in groups work correctly with AJAX.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxInGroupTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php
index 180381e45c1b..3f4543996f1f 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php
@@ -8,12 +8,12 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\Tests\file\Functional\FileFieldCreationTrait;
use Drupal\Tests\TestFileCreationTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests maintenance message during an AJAX call.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxMaintenanceModeTest extends WebDriverTestBase {
use FieldUiTestTrait;
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
index 03bd477123c1..284a3e35fa9b 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\Component\Utility\UrlHelper;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests AJAX responses.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class AjaxTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php
index cc81d142d453..877f255a6591 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Performs tests on AJAX framework commands.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class CommandsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
index be434633e5ef..beab4c6a242c 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
@@ -7,14 +7,13 @@ namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\ajax_test\Controller\AjaxTestController;
use Drupal\Core\Ajax\OpenModalDialogWithUrl;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore testdialog
-
/**
* Performs tests on opening and manipulating dialogs via AJAX commands.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class DialogTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php
index 60fd1f40b95f..5040430abae4 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ElementValidationTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Various tests of AJAX behavior.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class ElementValidationTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php
index 7a9b91c52b90..2a27a09a987a 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FocusFirstCommandTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests setting focus via AJAX command.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class FocusFirstCommandTest extends WebDriverTestBase {
/**
* {@inheritdoc}
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php
index 2ee6b8ddb2ce..68a9683a4906 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php
@@ -5,12 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that form values are properly delivered to AJAX callbacks.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class FormValuesTest extends WebDriverTestBase {
/**
@@ -33,9 +34,8 @@ class FormValuesTest extends WebDriverTestBase {
/**
* Submits forms with select and checkbox elements via Ajax.
- *
- * @dataProvider formModeProvider
*/
+ #[DataProvider('formModeProvider')]
public function testSimpleAjaxFormValue($form_mode): void {
$this->drupalGet('ajax_forms_test_get_form');
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php
index 69b49916163e..f18bf953dd82 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MessageCommandTest.php
@@ -5,13 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\ExpectationFailedException;
/**
* Tests adding messages via AJAX command.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class MessageCommandTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
index 6a0026976a90..40ed7ac76704 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
@@ -8,12 +8,12 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests AJAX-enabled forms when multiple instances of the form are on a page.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class MultiFormTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
index 6b2a17d4c6eb..92905a0c08ba 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalJavascriptTests\Ajax;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\hold_test\HoldTestHelper;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the throbber.
- *
- * @group Ajax
*/
+#[Group('Ajax')]
class ThrobberTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php b/core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php
index 0a61c5f03cbe..adade6bc4208 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php
@@ -4,12 +4,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
+
/**
* Tests that unnecessary or untracked XHRs will cause a test failure.
- *
- * @group javascript
- * @group legacy
*/
+#[Group('javascript')]
+#[IgnoreDeprecations]
class AjaxWaitTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php b/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php
index 2f11f7525eed..74c88ac48eed 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/BrowserWithJavascriptTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests if we can execute JavaScript in the browser.
- *
- * @group javascript
*/
+#[Group('javascript')]
class BrowserWithJavascriptTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php
index 5b77de188aa2..95847a5d2290 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Components/ComponentRenderTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Components;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the correct rendering of components.
- *
- * @group sdc
*/
+#[Group('sdc')]
class ComponentRenderTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php
index f16b300441de..3684ec3c4976 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/CsrfTokenRaceTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Core;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Test race condition for CSRF tokens for simultaneous requests.
- *
- * @group Session
*/
+#[Group('Session')]
class CsrfTokenRaceTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php
index 53b2c5dcb7a5..6e615f4b4f91 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php
@@ -10,12 +10,12 @@ use Drupal\entity_test\Entity\EntityTest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the 'timestamp' formatter when is used with time difference setting.
- *
- * @group Field
*/
+#[Group('Field')]
class TimestampFormatterWithTimeDiffTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php
index 0b5176182390..f35b5c72171b 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalJavascriptTests\Core\Field;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\views\Tests\ViewTestData;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the timestamp formatter used with time difference setting in views.
- *
- * @group Field
*/
+#[Group('Field')]
class TimestampFormatterWithTimeDiffViewsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
index 7c8af15a2e31..f538690daf99 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/FormGroupingElementsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Core\Form;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests for form grouping elements.
- *
- * @group form
*/
+#[Group('form')]
class FormGroupingElementsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php
index 189af6e49e61..ac41f01653fe 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Form/JavascriptStatesTest.php
@@ -6,6 +6,7 @@ namespace Drupal\FunctionalJavascriptTests\Core\Form;
use Drupal\filter\Entity\FilterFormat;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the state of elements based on another elements.
@@ -14,9 +15,8 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
* module under 'system' (core/modules/system/tests/module/form_test).
*
* @see Drupal\form_test\Form\JavascriptStatesForm
- *
- * @group javascript
*/
+#[Group('javascript')]
class JavascriptStatesTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php
index ce4cf583cd8c..4acec8e11102 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/JsMessageTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalJavascriptTests\Core;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\js_message_test\Controller\JSMessageTestController;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests core/drupal.message library.
- *
- * @group Javascript
*/
+#[Group('Javascript')]
class JsMessageTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
index 3df154e90500..b990be12549c 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Core;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests for the machine name field.
- *
- * @group field
*/
+#[Group('field')]
class MachineNameTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
index 8adf7a5685a5..94387c04633e 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalJavascriptTests\Core\Session;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\menu_link_content\Entity\MenuLinkContent;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that sessions don't expire.
- *
- * @group session
*/
+#[Group('session')]
class SessionTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
index abc6fd4c5ca4..2085b5518419 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogDeprecationsTest.php
@@ -5,13 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Dialog;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
/**
* Tests jQuery events deprecations.
- *
- * @group dialog
*/
+#[Group('dialog')]
class DialogDeprecationsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
index ed73ac1ff706..abda27ed3b70 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Dialog/DialogPositionTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Dialog;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the JavaScript functionality of the dialog position.
- *
- * @group dialog
*/
+#[Group('dialog')]
class DialogPositionTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
index 971af632a993..18fe44d8c4c3 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
@@ -4,18 +4,18 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\EntityReference;
-use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
-use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\entity_test\Entity\EntityTest;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the output of entity reference autocomplete widgets.
- *
- * @group entity_reference
*/
+#[Group('entity_reference')]
class EntityReferenceAutocompleteWidgetTest extends WebDriverTestBase {
use ContentTypeCreationTrait;
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php
index e45026d8960a..cb2fce7a36c1 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptDeprecationTest.php
@@ -4,12 +4,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
+
/**
* Tests Javascript deprecation notices.
- *
- * @group javascript
- * @group legacy
*/
+#[Group('javascript')]
+#[IgnoreDeprecations]
class JavascriptDeprecationTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php
index a310d4c9e6e4..c67e27551c07 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests that Drupal.throwError can be suppressed to allow a test to pass.
- *
- * @group javascript
*/
+#[Group('javascript')]
class JavascriptErrorsSuppressionTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php
index 3fb355523406..5f96e95dc2bb 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that Drupal.throwError will cause a test failure.
- *
- * @group javascript
*/
+#[Group('javascript')]
class JavascriptErrorsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php
index 31ec8c91675b..8054a7395997 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/JavascriptGetDrupalSettingsTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests Drupal settings retrieval in WebDriverTestBase tests.
- *
- * @group javascript
*/
+#[Group('javascript')]
class JavascriptGetDrupalSettingsTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php
index ad9ba4f89d8e..19cc4bf3a401 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php
@@ -5,15 +5,15 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\MachineName;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
-
use Drupal\language\Entity\ConfigurableLanguage;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the machine name transliteration functionality.
- *
- * @group javascript
- * @group #slow
*/
+#[Group('javascript')]
+#[Group('#slow')]
class MachineNameTransliterationTest extends WebDriverTestBase {
/**
@@ -46,9 +46,8 @@ class MachineNameTransliterationTest extends WebDriverTestBase {
/**
* Test for machine name transliteration functionality.
- *
- * @dataProvider machineNameInputOutput
*/
+ #[DataProvider('machineNameInputOutput')]
public function testMachineNameTransliterations($langcode, $input, $output): void {
$page = $this->getSession()->getPage();
if ($langcode !== 'en') {
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
index a9350a1976e6..0a14594369b6 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalJavascriptTests\TableDrag;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ExpectationException;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests draggable table.
- *
- * @group javascript
*/
+#[Group('javascript')]
class TableDragTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php
index 1ab9d65b3be7..e598f5cc04a4 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php
@@ -6,16 +6,18 @@ namespace Drupal\FunctionalJavascriptTests\Tests;
use Behat\Mink\Driver\Selenium2Driver;
use Drupal\entity_test\Entity\EntityTest;
+use Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\file\Functional\FileFieldCreationTrait;
use Drupal\Tests\TestFileCreationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the DrupalSelenium2Driver methods.
- *
- * @coversDefaultClass \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver
- * @group javascript
*/
+#[CoversClass(DrupalSelenium2Driver::class)]
+#[Group('javascript')]
class DrupalSelenium2DriverTest extends WebDriverTestBase {
use TestFileCreationTrait;
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php
index 866f04e3a72a..a8018c7b013a 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSInteractionTest.php
@@ -5,13 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Tests;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
use WebDriver\Exception;
/**
* Tests fault tolerant interactions.
- *
- * @group javascript
*/
+#[Group('javascript')]
class JSInteractionTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
index f200ed28ac98..6388bd0844e1 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php
@@ -8,12 +8,12 @@ use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ElementHtmlException;
use Drupal\Component\Utility\Timer;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests for the JSWebAssert class.
- *
- * @group javascript
*/
+#[Group('javascript')]
class JSWebAssertTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php
index dbc7874c735f..62ae39c4db49 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\block\FunctionalJavascript\BlockFilterTest;
+use PHPUnit\Framework\Attributes\Group;
/**
* Runs BlockFilterTest in Claro.
*
- * @group block
- *
* @see \Drupal\Tests\block\FunctionalJavascript\BlockFilterTest.
*/
+#[Group('block')]
class ClaroBlockFilterTest extends BlockFilterTest {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
index 85476468d815..c8e018ebfbe5 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php
@@ -6,14 +6,14 @@ namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\entity_test\EntityTestHelper;
use Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest;
+use PHPUnit\Framework\Attributes\Group;
/**
* Runs EntityDisplayTest in Claro.
*
- * @group claro
- *
* @see \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest.
*/
+#[Group('claro')]
class ClaroEntityDisplayTest extends EntityDisplayTest {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php
index 32f6256396b3..930c7f963a7b 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest;
+use PHPUnit\Framework\Attributes\Group;
/**
* Runs MenuUiJavascriptTest in Claro.
*
- * @group claro
- *
* @see \Drupal\Tests\menu_ui\FunctionalJavascript\MenuUiJavascriptTest;
*/
+#[Group('claro')]
class ClaroMenuUiJavascriptTest extends MenuUiJavascriptTest {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php
index c78ff99c80a3..7f110c1a4282 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php
@@ -9,12 +9,12 @@ use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase;
use Drupal\Tests\TestFileCreationTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that buttons in modals are not in their button pane.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroModalDisplayTest extends MediaLibraryTestBase {
use TestFileCreationTrait;
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php
index af01db8d2a8f..c090f658dc56 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\Tests\user\FunctionalJavascript\PasswordConfirmWidgetTest;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the password confirm widget with Claro theme.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroPasswordConfirmWidgetTest extends PasswordConfirmWidgetTest {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php
index 9938ad22d095..7dda74a5348e 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests draggable tables with Claro theme.
*
- * @group claro
- *
* @see \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest
*/
+#[Group('claro')]
class ClaroTableDragTest extends TableDragTest {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php
index e752b79a65af..3f6c21ad8755 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests Claro's Views Bulk Operations form.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroViewsBulkOperationsTest extends WebDriverTestBase {
use ContentTypeCreationTrait;
use NodeCreationTrait;
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php
index 28b3c46a9996..67474ad08a60 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Runs tests on Views UI using Claro.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroViewsUiTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroAvoidStorageUsingTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroAvoidStorageUsingTest.php
index ee1261a354b0..24d3ca85af26 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroAvoidStorageUsingTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroAvoidStorageUsingTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests usage of localStorage.
- *
- * @group olivero
*/
+#[Group('olivero')]
final class OliveroAvoidStorageUsingTest extends WebDriverTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php
index 6b0472702c0c..74278efdf4bc 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php
@@ -6,14 +6,14 @@ namespace Drupal\FunctionalJavascriptTests\Theme;
use Drupal\FunctionalJavascriptTests\Core\JsMessageTest;
use Drupal\js_message_test\Controller\JSMessageTestController;
+use PHPUnit\Framework\Attributes\Group;
/**
* Runs OliveroMessagesTest in Olivero.
*
- * @group olivero
- *
* @see \Drupal\FunctionalJavascriptTests\Core\JsMessageTest.
*/
+#[Group('olivero')]
class OliveroMessagesTest extends JsMessageTest {
/**
diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php
index 07a9fab674fb..9a2b78ebc775 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php
@@ -6,13 +6,17 @@ namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Component\FileCache\FileCacheFactory;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery
- * @group Annotation
- * @runTestsInSeparateProcesses
+ * Tests Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery.
*/
+#[CoversClass(AnnotatedClassDiscovery::class)]
+#[Group('Annotation')]
+#[RunTestsInSeparateProcesses]
class AnnotatedClassDiscoveryCachedTest extends TestCase {
/**
@@ -30,7 +34,7 @@ class AnnotatedClassDiscoveryCachedTest extends TestCase {
/**
* Tests that getDefinitions() retrieves the file cache correctly.
*
- * @covers ::getDefinitions
+ * @legacy-covers ::getDefinitions
*/
public function testGetDefinitions(): void {
// Path to the classes which we'll discover and parse annotation.
diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php
index a83d030b2aff..96174c148422 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryTest.php
@@ -7,13 +7,17 @@ namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\Plugin;
use Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery;
use Drupal\Component\FileCache\FileCacheFactory;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery
- * @group Annotation
- * @runTestsInSeparateProcesses
+ * Tests Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery.
*/
+#[CoversClass(AnnotatedClassDiscovery::class)]
+#[Group('Annotation')]
+#[RunTestsInSeparateProcesses]
class AnnotatedClassDiscoveryTest extends TestCase {
/**
@@ -28,8 +32,8 @@ class AnnotatedClassDiscoveryTest extends TestCase {
}
/**
- * @covers ::__construct
- * @covers ::getPluginNamespaces
+ * @legacy-covers ::__construct
+ * @legacy-covers ::getPluginNamespaces
*/
public function testGetPluginNamespaces(): void {
$discovery = new AnnotatedClassDiscovery(['com/example' => [__DIR__]]);
@@ -40,9 +44,9 @@ class AnnotatedClassDiscoveryTest extends TestCase {
}
/**
- * @covers ::getDefinitions
- * @covers ::prepareAnnotationDefinition
- * @covers ::getAnnotationReader
+ * @legacy-covers ::getDefinitions
+ * @legacy-covers ::prepareAnnotationDefinition
+ * @legacy-covers ::getAnnotationReader
*/
public function testGetDefinitions(): void {
$discovery = new AnnotatedClassDiscovery(['com\example' => [__DIR__ . '/Fixtures']]);
diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
index 80f3b31f82be..cb5d4727b4f7 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
@@ -5,17 +5,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\AnnotationBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\AnnotationBase
- * @group Annotation
+ * Tests Drupal\Component\Annotation\AnnotationBase.
*/
+#[CoversClass(AnnotationBase::class)]
+#[Group('Annotation')]
class AnnotationBaseTest extends TestCase {
/**
- * @covers ::getProvider
- * @covers ::setProvider
+ * @legacy-covers ::getProvider
+ * @legacy-covers ::setProvider
*/
public function testSetProvider(): void {
$plugin = new AnnotationBaseStub();
@@ -24,7 +27,7 @@ class AnnotationBaseTest extends TestCase {
}
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$plugin = new AnnotationBaseStub();
@@ -34,8 +37,8 @@ class AnnotationBaseTest extends TestCase {
}
/**
- * @covers ::getClass
- * @covers ::setClass
+ * @legacy-covers ::getClass
+ * @legacy-covers ::setClass
*/
public function testSetClass(): void {
$plugin = new AnnotationBaseStub();
diff --git a/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php b/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php
index c211193d1fd5..e4cc1f2b9218 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/DocParserIgnoredClassesTest.php
@@ -5,13 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\Doctrine\DocParser;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Doctrine\DocParser
- *
- * @group Annotation
+ * Tests Drupal\Component\Annotation\Doctrine\DocParser.
*/
+#[CoversClass(DocParser::class)]
+#[Group('Annotation')]
class DocParserIgnoredClassesTest extends TestCase {
/**
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php
index ab5d242262d9..96b501928a67 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php
@@ -2,38 +2,39 @@
namespace Drupal\Tests\Component\Annotation\Doctrine;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\TestWith;
use Drupal\Component\Annotation\Doctrine\StaticReflectionParser;
use Drupal\Component\Annotation\Reflection\MockFileFinder;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Doctrine\StaticReflectionParser
- *
- * @group Annotation
+ * Tests Drupal\Component\Annotation\Doctrine\StaticReflectionParser.
*/
+#[CoversClass(StaticReflectionParser::class)]
+#[Group('Annotation')]
class StaticReflectionParserTest extends TestCase {
- /**
- * @testWith ["AttributeClass", "\\Attribute", true]
- * ["AttributeClass", "attribute", true]
- * ["AttributeClass", "Attribute", true]
- * ["AttributeClass", "\\DoesNotExist", false]
- * ["Nonexistent", "NonexistentAttribute", false]
- * ["MultipleAttributes", "Attribute", true]
- * ["MultipleAttributes", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\AttributeClass", true]
- * ["MultipleAttributes", "DoesNotExist", false]
- * ["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
- * ["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
- * ["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
- * ["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
- * ["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true]
- * ["Relative", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\SubDir\\SubDirAttribute", true]
- * ["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
- * ["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
- * ["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
- * ["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
- * ["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true]
- */
+ #[TestWith(["AttributeClass", "\\Attribute", true])]
+ #[TestWith(["AttributeClass", "attribute", true])]
+ #[TestWith(["AttributeClass", "Attribute", true])]
+ #[TestWith(["AttributeClass", "\\DoesNotExist", false])]
+ #[TestWith(["Nonexistent", "NonexistentAttribute", false])]
+ #[TestWith(["MultipleAttributes", "Attribute", true])]
+ #[TestWith(["MultipleAttributes", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\AttributeClass", true])]
+ #[TestWith(["MultipleAttributes", "DoesNotExist", false])]
+ #[TestWith(["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true])]
+ #[TestWith(["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true])]
+ #[TestWith(["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true])]
+ #[TestWith(["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true])]
+ #[TestWith(["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleAttribute", true])]
+ #[TestWith(["Relative", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\SubDir\\SubDirAttribute", true])]
+ #[TestWith(["FullyQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true])]
+ #[TestWith(["Used", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true])]
+ #[TestWith(["UsedAs", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true])]
+ #[TestWith(["UsedAsQualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true])]
+ #[TestWith(["Qualified", "Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\ExtraAttributes\\ExampleParentAttribute", true])]
public function testAttribute(string $class, string $attribute_class, bool $expected): void {
$finder = MockFileFinder::create(__DIR__ . '/Fixtures/Attribute/' . $class . '.php');
$parser = new StaticReflectionParser('\\Drupal\\Tests\\Component\\Annotation\\Doctrine\\Fixtures\\Attribute\\' . $class, $finder);
diff --git a/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php b/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php
index 6511a2c980c2..c227a276a1ec 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/MockFileFinderTest.php
@@ -5,17 +5,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\Reflection\MockFileFinder;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Reflection\MockFileFinder
- * @group Annotation
+ * Tests Drupal\Component\Annotation\Reflection\MockFileFinder.
*/
+#[CoversClass(MockFileFinder::class)]
+#[Group('Annotation')]
class MockFileFinderTest extends TestCase {
/**
- * @covers ::create
- * @covers ::findFile
+ * @legacy-covers ::create
+ * @legacy-covers ::findFile
*/
public function testFindFile(): void {
$tmp = MockFileFinder::create('test_filename.txt');
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php
index ab59964f3396..7852e14c1b1e 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php
@@ -8,19 +8,22 @@ use Drupal\Component\Annotation\Plugin;
use Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator;
use Drupal\Component\Plugin\Definition\PluginDefinition;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator
- * @group Plugin
+ * Tests Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator.
*/
+#[CoversClass(AnnotationBridgeDecorator::class)]
+#[Group('Plugin')]
class AnnotationBridgeDecoratorTest extends TestCase {
use ProphecyTrait;
/**
- * @covers ::getDefinitions
+ * @legacy-covers ::getDefinitions
*/
public function testGetDefinitions(): void {
$definitions = [];
diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php
index 17fb399a7264..4ff731f364f1 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php
@@ -5,16 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\PluginID;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\PluginID
- * @group Annotation
+ * Tests Drupal\Component\Annotation\PluginID.
*/
+#[CoversClass(PluginID::class)]
+#[Group('Annotation')]
class PluginIdTest extends TestCase {
/**
- * @covers ::get
+ * @legacy-covers ::get
*/
public function testGet(): void {
// Assert plugin starts empty.
@@ -37,7 +40,7 @@ class PluginIdTest extends TestCase {
}
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$plugin = new PluginID();
diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php
index ad02c2ddba47..857044e4b6c9 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php
@@ -5,18 +5,21 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Annotation;
use Drupal\Component\Annotation\Plugin;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin
- * @group Annotation
+ * Tests Drupal\Component\Annotation\Plugin.
*/
+#[CoversClass(Plugin::class)]
+#[Group('Annotation')]
class PluginTest extends TestCase {
/**
- * @covers ::__construct
- * @covers ::parse
- * @covers ::get
+ * @legacy-covers ::__construct
+ * @legacy-covers ::parse
+ * @legacy-covers ::get
*/
public function testGet(): void {
// Assert all values are accepted through constructor and default value is
@@ -51,7 +54,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::getProvider
+ * @legacy-covers ::getProvider
*/
public function testGetProvider(): void {
$plugin = new Plugin(['provider' => 'example']);
@@ -59,7 +62,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::setProvider
+ * @legacy-covers ::setProvider
*/
public function testSetProvider(): void {
$plugin = new Plugin([]);
@@ -68,7 +71,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$plugin = new Plugin(['id' => 'example']);
@@ -76,7 +79,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::getClass
+ * @legacy-covers ::getClass
*/
public function testGetClass(): void {
$plugin = new Plugin(['class' => 'example']);
@@ -84,7 +87,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::setClass
+ * @legacy-covers ::setClass
*/
public function testSetClass(): void {
$plugin = new Plugin([]);
diff --git a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
index 0d3f5d221a32..2d02f97c5716 100644
--- a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
+++ b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
@@ -4,14 +4,18 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Assertion;
-use PHPUnit\Framework\TestCase;
use Drupal\Component\Assertion\Inspector;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Assertion\Inspector
- * @group Assertion
+ * Tests Drupal\Component\Assertion\Inspector.
*/
+#[CoversClass(Inspector::class)]
+#[Group('Assertion')]
class InspectorTest extends TestCase {
use ExpectDeprecationTrait;
@@ -19,9 +23,9 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are strings.
*
- * @covers ::assertAllStrings
- * @dataProvider providerTestAssertAllStrings
+ * @legacy-covers ::assertAllStrings
*/
+ #[DataProvider('providerTestAssertAllStrings')]
public function testAssertAllStrings($input, $expected): void {
$this->assertSame($expected, Inspector::assertAllStrings($input));
}
@@ -55,7 +59,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are strings or objects with __toString().
*
- * @covers ::assertAllStringable
+ * @legacy-covers ::assertAllStringable
*/
public function testAssertAllStringable(): void {
$this->assertTrue(Inspector::assertAllStringable([]));
@@ -67,7 +71,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are arrays.
*
- * @covers ::assertAllArrays
+ * @legacy-covers ::assertAllArrays
*/
public function testAssertAllArrays(): void {
$this->assertTrue(Inspector::assertAllArrays([]));
@@ -78,7 +82,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting array is 0-indexed - the strict definition of array.
*
- * @covers ::assertStrictArray
+ * @legacy-covers ::assertStrictArray
*/
public function testAssertStrictArray(): void {
$this->assertTrue(Inspector::assertStrictArray([]));
@@ -89,7 +93,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are strict arrays.
*
- * @covers ::assertAllStrictArrays
+ * @legacy-covers ::assertAllStrictArrays
*/
public function testAssertAllStrictArrays(): void {
$this->assertTrue(Inspector::assertAllStrictArrays([]));
@@ -100,7 +104,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members have specified keys.
*
- * @covers ::assertAllHaveKey
+ * @legacy-covers ::assertAllHaveKey
*/
public function testAssertAllHaveKey(): void {
$this->assertTrue(Inspector::assertAllHaveKey([]));
@@ -113,7 +117,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are integers.
*
- * @covers ::assertAllIntegers
+ * @legacy-covers ::assertAllIntegers
*/
public function testAssertAllIntegers(): void {
$this->assertTrue(Inspector::assertAllIntegers([]));
@@ -125,7 +129,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are floating point variables.
*
- * @covers ::assertAllFloat
+ * @legacy-covers ::assertAllFloat
*/
public function testAssertAllFloat(): void {
$this->assertTrue(Inspector::assertAllFloat([]));
@@ -138,7 +142,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are callable.
*
- * @covers ::assertAllCallable
+ * @legacy-covers ::assertAllCallable
*/
public function testAllCallable(): void {
$this->assertTrue(Inspector::assertAllCallable([
@@ -164,7 +168,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are !empty().
*
- * @covers ::assertAllNotEmpty
+ * @legacy-covers ::assertAllNotEmpty
*/
public function testAllNotEmpty(): void {
$this->assertTrue(Inspector::assertAllNotEmpty([1, 'two']));
@@ -174,7 +178,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all arguments are numbers or strings castable to numbers.
*
- * @covers ::assertAllNumeric
+ * @legacy-covers ::assertAllNumeric
*/
public function testAssertAllNumeric(): void {
$this->assertTrue(Inspector::assertAllNumeric([1, '2', 3.14]));
@@ -184,7 +188,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting strstr() or stristr() match.
*
- * @covers ::assertAllMatch
+ * @legacy-covers ::assertAllMatch
*/
public function testAssertAllMatch(): void {
$this->assertTrue(Inspector::assertAllMatch('f', ['fee', 'fi', 'fo']));
@@ -198,7 +202,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting regular expression match.
*
- * @covers ::assertAllRegularExpressionMatch
+ * @legacy-covers ::assertAllRegularExpressionMatch
*/
public function testAssertAllRegularExpressionMatch(): void {
$this->assertTrue(Inspector::assertAllRegularExpressionMatch('/f/i', ['fee', 'fi', 'fo']));
@@ -212,7 +216,7 @@ class InspectorTest extends TestCase {
/**
* Tests asserting all members are objects.
*
- * @covers ::assertAllObjects
+ * @legacy-covers ::assertAllObjects
*/
public function testAssertAllObjects(): void {
$this->assertTrue(Inspector::assertAllObjects([new \ArrayObject(), new \ArrayObject()]));
diff --git a/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php
index 9653180cfa22..0b8322303fb2 100644
--- a/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php
+++ b/core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php
@@ -6,16 +6,19 @@ namespace Drupal\Tests\Component\ClassFinder;
use Composer\Autoload\ClassLoader;
use Drupal\Component\ClassFinder\ClassFinder;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\ClassFinder\ClassFinder
- * @group ClassFinder
+ * Tests Drupal\Component\ClassFinder\ClassFinder.
*/
+#[CoversClass(ClassFinder::class)]
+#[Group('ClassFinder')]
class ClassFinderTest extends TestCase {
/**
- * @covers ::findFile
+ * @legacy-covers ::findFile
*/
public function testFindFile(): void {
$finder = new ClassFinder();
diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
index ae46c3cc5a56..0a09e3adb4b8 100644
--- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
+++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Datetime;
use Drupal\Component\Datetime\DateTimePlus;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus
- * @group Datetime
+ * Tests Drupal\Component\Datetime\DateTimePlus.
*/
+#[CoversClass(DateTimePlus::class)]
+#[Group('Datetime')]
class DateTimePlusTest extends TestCase {
/**
@@ -22,9 +26,8 @@ class DateTimePlusTest extends TestCase {
* Timezone argument for DateTimePlus.
* @param string $expected
* Expected output from DateTimePlus::format().
- *
- * @dataProvider providerTestDates
*/
+ #[DataProvider('providerTestDates')]
public function testDates($input, $timezone, $expected): void {
$date = new DateTimePlus($input, $timezone);
$value = $date->format('c');
@@ -44,9 +47,8 @@ class DateTimePlusTest extends TestCase {
* Timezone argument for DateTimePlus.
* @param string $expected
* Expected output from DateTimePlus::format().
- *
- * @dataProvider providerTestDateArrays
*/
+ #[DataProvider('providerTestDateArrays')]
public function testDateArrays($input, $timezone, $expected): void {
$date = DateTimePlus::createFromArray($input, $timezone);
$value = $date->format('c');
@@ -68,9 +70,8 @@ class DateTimePlusTest extends TestCase {
* Absolute flag for DateTimePlus::diff method.
* @param \DateInterval $expected
* The expected result of the DateTimePlus::diff operation.
- *
- * @dataProvider providerTestDateDiff
*/
+ #[DataProvider('providerTestDateDiff')]
public function testDateDiff($input1, $input2, $absolute, \DateInterval $expected): void {
$interval = $input1->diff($input2, $absolute);
$this->assertEquals($interval, $expected);
@@ -85,9 +86,8 @@ class DateTimePlusTest extends TestCase {
* Date argument for DateTimePlus::diff method.
* @param bool $absolute
* Absolute flag for DateTimePlus::diff method.
- *
- * @dataProvider providerTestInvalidDateDiff
*/
+ #[DataProvider('providerTestInvalidDateDiff')]
public function testInvalidDateDiff($input1, $input2, $absolute): void {
$this->expectException(\BadMethodCallException::class);
$this->expectExceptionMessage('Method Drupal\Component\Datetime\DateTimePlus::diff expects parameter 1 to be a \DateTime or \Drupal\Component\Datetime\DateTimePlus object');
@@ -103,9 +103,8 @@ class DateTimePlusTest extends TestCase {
* Timezone argument for DateTimePlus.
* @param string $class
* The Exception subclass to expect to be thrown.
- *
- * @dataProvider providerTestInvalidDateArrays
*/
+ #[DataProvider('providerTestInvalidDateArrays')]
public function testInvalidDateArrays($input, $timezone, $class): void {
$this->expectException($class);
$this->assertInstanceOf(
@@ -121,9 +120,8 @@ class DateTimePlusTest extends TestCase {
* Input argument for DateTimePlus::checkArray().
* @param bool $expected
* The expected result of DateTimePlus::checkArray().
- *
- * @dataProvider providerTestCheckArray
*/
+ #[DataProvider('providerTestCheckArray')]
public function testCheckArray(array $array, $expected): void {
$this->assertSame(
$expected,
@@ -157,9 +155,8 @@ class DateTimePlusTest extends TestCase {
* DateTimePlus::getTimeZone()::getName(), after timezone transform.
* - 'expected_transform_offset' - Expected output from
* DateTimePlus::getOffset(), after timezone transform.
- *
- * @dataProvider providerTestTimestamp
*/
+ #[DataProvider('providerTestTimestamp')]
public function testTimestamp($input, array $initial, array $transform): void {
// Initialize a new date object.
$date = DateTimePlus::createFromTimestamp($input, $initial['timezone']);
@@ -175,9 +172,8 @@ class DateTimePlusTest extends TestCase {
* @see testTimestamp()
* @param array $transform
* @see testTimestamp()
- *
- * @dataProvider providerTestDateTimestamp
*/
+ #[DataProvider('providerTestDateTimestamp')]
public function testDateTimestamp($input, array $initial, array $transform): void {
// Initialize a new date object.
$date = new DateTimePlus($input, $initial['timezone']);
@@ -240,9 +236,8 @@ class DateTimePlusTest extends TestCase {
* Format argument for DateTimePlus::format().
* @param string $expected
* Expected output from DateTimePlus::format().
- *
- * @dataProvider providerTestDateFormat
*/
+ #[DataProvider('providerTestDateFormat')]
public function testDateFormat($input, $timezone, $format, $format_date, $expected): void {
$date = DateTimePlus::createFromFormat($format, $input, $timezone);
$value = $date->format($format_date);
@@ -262,9 +257,8 @@ class DateTimePlusTest extends TestCase {
* Message to print if no errors are thrown by the invalid dates.
* @param string $class
* The Exception subclass to expect to be thrown.
- *
- * @dataProvider providerTestInvalidDates
*/
+ #[DataProvider('providerTestInvalidDates')]
public function testInvalidDates($input, $timezone, $format, $message, $class): void {
$this->expectException($class);
DateTimePlus::createFromFormat($format, $input, $timezone);
@@ -283,9 +277,8 @@ class DateTimePlusTest extends TestCase {
* Expected timezone returned from DateTimePlus::getTimezone::getName().
* @param string $message
* Message to print on test failure.
- *
- * @dataProvider providerTestDateTimezone
*/
+ #[DataProvider('providerTestDateTimezone')]
public function testDateTimezone($input, $timezone, $expected_timezone, $message): void {
$date = new DateTimePlus($input, $timezone);
$timezone = $date->getTimezone()->getName();
@@ -755,10 +748,9 @@ class DateTimePlusTest extends TestCase {
* @param string[] $errors
* An array of error messages.
*
- * @covers ::__construct
- *
- * @dataProvider providerTestInvalidConstructor
+ * @legacy-covers ::__construct
*/
+ #[DataProvider('providerTestInvalidConstructor')]
public function testInvalidConstructor($time, array $errors): void {
$date = new DateTimePlus($time);
@@ -870,7 +862,7 @@ class DateTimePlusTest extends TestCase {
/**
* Tests that object methods are chainable.
*
- * @covers ::__call
+ * @legacy-covers ::__call
*/
public function testChainable(): void {
$date = new DateTimePlus('now', 'Australia/Sydney');
@@ -894,7 +886,7 @@ class DateTimePlusTest extends TestCase {
/**
* Tests that non-chainable methods work.
*
- * @covers ::__call
+ * @legacy-covers ::__call
*/
public function testChainableNonChainable(): void {
$datetime1 = new DateTimePlus('2009-10-11 12:00:00');
@@ -907,7 +899,7 @@ class DateTimePlusTest extends TestCase {
/**
* Tests that chained calls to non-existent functions throw an exception.
*
- * @covers ::__call
+ * @legacy-covers ::__call
*/
public function testChainableNonCallable(): void {
$this->expectException(\BadMethodCallException::class);
@@ -917,7 +909,7 @@ class DateTimePlusTest extends TestCase {
}
/**
- * @covers ::getPhpDateTime
+ * @legacy-covers ::getPhpDateTime
*/
public function testGetPhpDateTime(): void {
$new_york = new \DateTimeZone('America/New_York');
diff --git a/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php b/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php
index d4b02de5d30a..a394e1b99c98 100644
--- a/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php
+++ b/core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php
@@ -5,17 +5,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Datetime;
use Drupal\Component\Datetime\Time;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
/**
* Tests that getRequest(Micro)Time works when no underlying request exists.
- *
- * @coversDefaultClass \Drupal\Component\Datetime\Time
- * @group Datetime
- * @group #slow
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
*/
+#[CoversClass(Time::class)]
+#[Group('Datetime')]
+#[Group('#slow')]
+#[PreserveGlobalState(FALSE)]
+#[RunTestsInSeparateProcesses]
class TimeWithNoRequestTest extends TestCase {
/**
@@ -40,7 +43,7 @@ class TimeWithNoRequestTest extends TestCase {
/**
* Tests the getRequestTime method.
*
- * @covers ::getRequestTime
+ * @legacy-covers ::getRequestTime
*/
public function testGetRequestTimeImmutable(): void {
$requestTime = $this->time->getRequestTime();
@@ -51,7 +54,7 @@ class TimeWithNoRequestTest extends TestCase {
/**
* Tests the getRequestMicroTime method.
*
- * @covers ::getRequestMicroTime
+ * @legacy-covers ::getRequestMicroTime
*/
public function testGetRequestMicroTimeImmutable(): void {
$requestTime = $this->time->getRequestMicroTime();
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
index 6f8880376327..b57d2740704b 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
@@ -4,9 +4,13 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\DependencyInjection;
+use Drupal\Component\DependencyInjection\Container;
use Drupal\Component\Utility\Crypt;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
+use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
@@ -15,12 +19,12 @@ use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
-use Prophecy\Argument;
/**
- * @coversDefaultClass \Drupal\Component\DependencyInjection\Container
- * @group DependencyInjection
+ * Tests Drupal\Component\DependencyInjection\Container.
*/
+#[CoversClass(Container::class)]
+#[Group('DependencyInjection')]
class ContainerTest extends TestCase {
use ExpectDeprecationTrait;
use ProphecyTrait;
@@ -66,7 +70,7 @@ class ContainerTest extends TestCase {
/**
* Tests that passing a non-supported format throws an InvalidArgumentException.
*
- * @covers ::__construct
+ * @legacy-covers ::__construct
*/
public function testConstruct(): void {
$container_definition = $this->getMockContainerDefinition();
@@ -78,7 +82,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::getParameter() works properly.
*
- * @covers ::getParameter
+ * @legacy-covers ::getParameter
*/
public function testGetParameter(): void {
$this->assertEquals($this->containerDefinition['parameters']['some_config'], $this->container->getParameter('some_config'), 'Container parameter matches for %some_config%.');
@@ -88,9 +92,9 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::getParameter() works for non-existing parameters.
*
- * @covers ::getParameter
- * @covers ::getParameterAlternatives
- * @covers ::getAlternatives
+ * @legacy-covers ::getParameter
+ * @legacy-covers ::getParameterAlternatives
+ * @legacy-covers ::getAlternatives
*/
public function testGetParameterIfNotFound(): void {
$this->expectException(ParameterNotFoundException::class);
@@ -100,7 +104,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::getParameter() works properly for NULL parameters.
*
- * @covers ::getParameter
+ * @legacy-covers ::getParameter
*/
public function testGetParameterIfNotFoundBecauseNull(): void {
$this->expectException(ParameterNotFoundException::class);
@@ -110,7 +114,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::hasParameter() works properly.
*
- * @covers ::hasParameter
+ * @legacy-covers ::hasParameter
*/
public function testHasParameter(): void {
$this->assertTrue($this->container->hasParameter('some_config'), 'Container parameters include %some_config%.');
@@ -120,7 +124,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::setParameter() in an unfrozen case works properly.
*
- * @covers ::setParameter
+ * @legacy-covers ::setParameter
*/
public function testSetParameterWithUnfrozenContainer(): void {
$container_definition = $this->containerDefinition;
@@ -133,7 +137,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::setParameter() in a frozen case works properly.
*
- * @covers ::setParameter
+ * @legacy-covers ::setParameter
*/
public function testSetParameterWithFrozenContainer(): void {
$this->container = new $this->containerClass($this->containerDefinition);
@@ -144,8 +148,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGet(): void {
$container = $this->container->get('service_container');
@@ -171,8 +175,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-shared services works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForNonSharedService(): void {
$service = $this->container->get('non_shared_service');
@@ -184,8 +188,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() works properly for class from parameters.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForClassFromParameter(): void {
$container_definition = $this->containerDefinition;
@@ -200,7 +204,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::set() works properly.
*
- * @covers ::set
+ * @legacy-covers ::set
*/
public function testSet(): void {
$this->assertNull($this->container->get('new_id', ContainerInterface::NULL_ON_INVALID_REFERENCE));
@@ -213,7 +217,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::has() works properly.
*
- * @covers ::has
+ * @legacy-covers ::has
*/
public function testHas(): void {
$this->assertTrue($this->container->has('other.service'));
@@ -228,7 +232,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::has() for aliased services works properly.
*
- * @covers ::has
+ * @legacy-covers ::has
*/
public function testHasForAliasedService(): void {
$service = $this->container->has('service.provider');
@@ -239,8 +243,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for circular dependencies works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForCircularServices(): void {
$this->expectException(ServiceCircularReferenceException::class);
@@ -250,10 +254,10 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent services works properly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::getAlternatives
- * @covers ::getServiceAlternatives
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::getAlternatives
+ * @legacy-covers ::getServiceAlternatives
*/
public function testGetForNonExistentService(): void {
$this->expectException(ServiceNotFoundException::class);
@@ -263,8 +267,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for a serialized definition works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForSerializedServiceDefinition(): void {
$container_definition = $this->containerDefinition;
@@ -283,9 +287,9 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent parameters works properly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testGetForNonExistentParameterDependency(): void {
$service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
@@ -295,9 +299,9 @@ class ContainerTest extends TestCase {
/**
* Tests Container::get() with an exception due to missing parameter on the second call.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testGetForParameterDependencyWithExceptionOnSecondCall(): void {
$service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
@@ -312,9 +316,9 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent parameters works properly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testGetForNonExistentParameterDependencyWithException(): void {
$this->expectException(InvalidArgumentException::class);
@@ -324,9 +328,9 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent dependencies works properly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testGetForNonExistentServiceDependency(): void {
$service = $this->container->get('service_dependency_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
@@ -336,10 +340,10 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent dependencies works properly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
- * @covers ::getAlternatives
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
+ * @legacy-covers ::getAlternatives
*/
public function testGetForNonExistentServiceDependencyWithException(): void {
$this->expectException(ServiceNotFoundException::class);
@@ -349,8 +353,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for non-existent services works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForNonExistentServiceWhenUsingNull(): void {
$this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does not throw exception.');
@@ -359,8 +363,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for NULL service works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForNonExistentNULLService(): void {
$this->expectException(ServiceNotFoundException::class);
@@ -370,8 +374,8 @@ class ContainerTest extends TestCase {
/**
* Tests multiple Container::get() calls for non-existing dependencies work.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForNonExistentServiceMultipleTimes(): void {
$container = new $this->containerClass();
@@ -383,9 +387,9 @@ class ContainerTest extends TestCase {
/**
* Tests multiple Container::get() calls with exception on the second time.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::getAlternatives
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::getAlternatives
*/
public function testGetForNonExistentServiceWithExceptionOnSecondCall(): void {
$this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does nto throw exception.');
@@ -396,8 +400,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for aliased services works properly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForAliasedService(): void {
$service = $this->container->get('service.provider');
@@ -408,8 +412,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for synthetic services works - if defined.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForSyntheticService(): void {
$synthetic_service = new \stdClass();
@@ -421,8 +425,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for synthetic services throws an Exception if not defined.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForSyntheticServiceWithException(): void {
$this->expectException(RuntimeException::class);
@@ -432,8 +436,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for services with file includes works.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetWithFileInclude(): void {
$this->container->get('container_test_file_service_test');
@@ -444,9 +448,9 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for various arguments lengths works.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testGetForInstantiationWithVariousArgumentLengths(): void {
$args = [];
@@ -460,8 +464,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for wrong factories works correctly.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForWrongFactory(): void {
$this->expectException(RuntimeException::class);
@@ -471,8 +475,8 @@ class ContainerTest extends TestCase {
/**
* Tests Container::get() for factories via services (Symfony 2.7.0).
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForFactoryService(): void {
$factory_service = $this->container->get('factory_service');
@@ -483,8 +487,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for factories via class works (Symfony 2.7.0).
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForFactoryClass(): void {
$service = $this->container->get('service.provider');
@@ -498,8 +502,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for configurable services throws an Exception.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForConfiguratorWithException(): void {
$this->expectException(InvalidArgumentException::class);
@@ -509,8 +513,8 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::get() for configurable services works.
*
- * @covers ::get
- * @covers ::createService
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
*/
public function testGetForConfigurator(): void {
$container = $this->container;
@@ -532,9 +536,9 @@ class ContainerTest extends TestCase {
/**
* Tests that private services work correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForPrivateService(): void {
$service = $this->container->get('service_using_private');
@@ -551,9 +555,9 @@ class ContainerTest extends TestCase {
/**
* Tests that private service sharing works correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForSharedPrivateService(): void {
$service = $this->container->get('service_using_shared_private');
@@ -570,9 +574,9 @@ class ContainerTest extends TestCase {
/**
* Tests that services with an array of arguments work correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForArgumentsUsingDeepArray(): void {
$service = $this->container->get('service_using_array');
@@ -583,9 +587,9 @@ class ContainerTest extends TestCase {
/**
* Tests that services that are optional work correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForOptionalServiceDependencies(): void {
$service = $this->container->get('service_with_optional_dependency');
@@ -595,9 +599,9 @@ class ContainerTest extends TestCase {
/**
* Tests that services wrapped in a closure work correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForServiceReferencedViaServiceClosure(): void {
$service = $this->container->get('service_within_service_closure');
@@ -610,9 +614,9 @@ class ContainerTest extends TestCase {
/**
* Tests that an invalid argument throw an Exception.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForInvalidArgument(): void {
$this->expectException(InvalidArgumentException::class);
@@ -622,9 +626,9 @@ class ContainerTest extends TestCase {
/**
* Tests that invalid arguments throw an Exception.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForInvalidArguments(): void {
// In case the machine-optimized format is not used, we need to simulate the
@@ -639,9 +643,9 @@ class ContainerTest extends TestCase {
/**
* Tests that a parameter that points to a service works correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForServiceInstantiatedFromParameter(): void {
$service = $this->container->get('service.provider');
@@ -652,7 +656,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::initialized works correctly.
*
- * @covers ::initialized
+ * @legacy-covers ::initialized
*/
public function testInitialized(): void {
$this->assertFalse($this->container->initialized('late.service'), 'Late service is not initialized.');
@@ -663,7 +667,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::initialized works correctly for aliases.
*
- * @covers ::initialized
+ * @legacy-covers ::initialized
*/
public function testInitializedForAliases(): void {
$this->assertFalse($this->container->initialized('late.service_alias'), 'Late service is not initialized.');
@@ -674,7 +678,7 @@ class ContainerTest extends TestCase {
/**
* Tests that Container::getServiceIds() works properly.
*
- * @covers ::getServiceIds
+ * @legacy-covers ::getServiceIds
*/
public function testGetServiceIds(): void {
$service_definition_keys = array_merge(['service_container'], array_keys($this->containerDefinition['services']));
@@ -691,9 +695,9 @@ class ContainerTest extends TestCase {
/**
* Tests that raw type services arguments are resolved correctly.
*
- * @covers ::get
- * @covers ::createService
- * @covers ::resolveServicesAndParameters
+ * @legacy-covers ::get
+ * @legacy-covers ::createService
+ * @legacy-covers ::resolveServicesAndParameters
*/
public function testResolveServicesAndParametersForRawArgument(): void {
$this->assertEquals(['ccc'], $this->container->get('service_with_raw_argument')->getArguments());
@@ -715,7 +719,7 @@ class ContainerTest extends TestCase {
/**
* Tests Container::reset().
*
- * @covers ::reset
+ * @legacy-covers ::reset
*/
public function testReset(): void {
$this->assertFalse($this->container->initialized('late.service'), 'Late service is not initialized.');
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
index 99113913a7f2..ed02dc435ebd 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
@@ -4,12 +4,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\DependencyInjection;
+use Drupal\Component\DependencyInjection\PhpArrayContainer;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
- * @coversDefaultClass \Drupal\Component\DependencyInjection\PhpArrayContainer
- * @group DependencyInjection
+ * Tests Drupal\Component\DependencyInjection\PhpArrayContainer.
*/
+#[CoversClass(PhpArrayContainer::class)]
+#[Group('DependencyInjection')]
class PhpArrayContainerTest extends ContainerTest {
/**
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php
index 2bdac0cc4d48..db16c20e1f81 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ReverseContainerTest.php
@@ -5,6 +5,9 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\DependencyInjection;
use Drupal\Component\DependencyInjection\ReverseContainer;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -13,15 +16,14 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
*
* The reverse container uses a static to maintain information across
* container rebuilds.
- *
- * @runTestsInSeparateProcesses
- * @coversDefaultClass \Drupal\Component\DependencyInjection\ReverseContainer
- * @group DependencyInjection
*/
+#[CoversClass(ReverseContainer::class)]
+#[Group('DependencyInjection')]
+#[RunTestsInSeparateProcesses]
class ReverseContainerTest extends TestCase {
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$container = new ContainerBuilder();
@@ -37,7 +39,7 @@ class ReverseContainerTest extends TestCase {
}
/**
- * @covers ::recordContainer
+ * @legacy-covers ::recordContainer
*/
public function testRecordContainer(): void {
$container = new ContainerBuilder();
diff --git a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
index 696dcb852032..cb53b3cee21e 100644
--- a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
+++ b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
@@ -6,15 +6,16 @@ namespace Drupal\Tests\Component\Diff;
use Drupal\Component\Diff\Diff;
use Drupal\Component\Diff\DiffFormatter;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Test DiffFormatter classes.
- *
- * @coversDefaultClass \Drupal\Component\Diff\DiffFormatter
- *
- * @group Diff
*/
+#[CoversClass(DiffFormatter::class)]
+#[Group('Diff')]
class DiffFormatterTest extends TestCase {
/**
@@ -47,9 +48,9 @@ class DiffFormatterTest extends TestCase {
/**
* Tests whether op classes returned by DiffEngine::diff() match expectations.
*
- * @covers ::format
- * @dataProvider provideTestDiff
+ * @legacy-covers ::format
*/
+ #[DataProvider('provideTestDiff')]
public function testDiff($expected, $from, $to): void {
$diff = new Diff($from, $to);
$formatter = new DiffFormatter();
diff --git a/core/tests/Drupal/Tests/Component/Diff/DiffOpOutputBuilderTest.php b/core/tests/Drupal/Tests/Component/Diff/DiffOpOutputBuilderTest.php
index 29143ca9b2b0..e68c1ad5f634 100644
--- a/core/tests/Drupal/Tests/Component/Diff/DiffOpOutputBuilderTest.php
+++ b/core/tests/Drupal/Tests/Component/Diff/DiffOpOutputBuilderTest.php
@@ -6,17 +6,20 @@ namespace Drupal\Tests\Component\Diff;
use Drupal\Component\Diff\DiffOpOutputBuilder;
use Drupal\Component\Diff\Engine\DiffOpAdd;
-use Drupal\Component\Diff\Engine\DiffOpCopy;
use Drupal\Component\Diff\Engine\DiffOpChange;
+use Drupal\Component\Diff\Engine\DiffOpCopy;
use Drupal\Component\Diff\Engine\DiffOpDelete;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\Diff\Differ;
/**
- * @coversDefaultClass \Drupal\Component\Diff\DiffOpOutputBuilder
- *
- * @group Diff
+ * Tests Drupal\Component\Diff\DiffOpOutputBuilder.
*/
+#[CoversClass(DiffOpOutputBuilder::class)]
+#[Group('Diff')]
class DiffOpOutputBuilderTest extends TestCase {
/**
@@ -91,9 +94,9 @@ class DiffOpOutputBuilderTest extends TestCase {
/**
* Tests whether op classes returned match expectations.
*
- * @covers ::toOpsArray
- * @dataProvider provideTestDiff
+ * @legacy-covers ::toOpsArray
*/
+ #[DataProvider('provideTestDiff')]
public function testToOpsArray(array $expected, array $from, array $to): void {
$diffOpBuilder = new DiffOpOutputBuilder();
$differ = new Differ($diffOpBuilder);
@@ -102,9 +105,9 @@ class DiffOpOutputBuilderTest extends TestCase {
}
/**
- * @covers ::getDiff
- * @dataProvider provideTestDiff
+ * @legacy-covers ::getDiff
*/
+ #[DataProvider('provideTestDiff')]
public function testGetDiff(array $expected, array $from, array $to): void {
$differ = new Differ(new DiffOpOutputBuilder());
$diff = $differ->diff($from, $to);
@@ -114,7 +117,7 @@ class DiffOpOutputBuilderTest extends TestCase {
/**
* Tests that two files can be successfully diffed.
*
- * @covers ::toOpsArray
+ * @legacy-covers ::toOpsArray
*/
public function testDiffInfiniteLoop(): void {
$from = explode("\n", file_get_contents(__DIR__ . '/Engine/fixtures/file1.txt'));
diff --git a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php
index eb006d115e83..27e9bbd38c49 100644
--- a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php
+++ b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php
@@ -4,28 +4,26 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Diff\Engine;
-// cspell:ignore HWLDFWordAccumulator
-
use Drupal\Component\Diff\Engine\HWLDFWordAccumulator;
+// cspell:ignore HWLDFWordAccumulator
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
// cspell:ignore wordword
-
/**
* Test HWLDFWordAccumulator.
- *
- * @coversDefaultClass \Drupal\Component\Diff\Engine\HWLDFWordAccumulator
- *
- * @group Diff
*/
+#[CoversClass(HWLDFWordAccumulator::class)]
+#[Group('Diff')]
class HWLDFWordAccumulatorTest extends TestCase {
/**
* Verify that we only get back a NBSP from an empty accumulator.
*
- * @covers ::getLines
- *
* @see Drupal\Component\Diff\Engine\HWLDFWordAccumulator::NBSP
+ * @legacy-covers ::getLines
*/
public function testGetLinesEmpty(): void {
$acc = new HWLDFWordAccumulator();
@@ -47,9 +45,9 @@ class HWLDFWordAccumulatorTest extends TestCase {
}
/**
- * @covers ::addWords
- * @dataProvider provideAddWords
+ * @legacy-covers ::addWords
*/
+ #[DataProvider('provideAddWords')]
public function testAddWords($expected, $words, $tag): void {
$acc = new HWLDFWordAccumulator();
$acc->addWords($words, $tag);
diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
index 816def560ed5..0b6521acd64b 100644
--- a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
@@ -8,15 +8,15 @@ use Drupal\Component\Discovery\DiscoveryException;
use Drupal\Component\Discovery\YamlDirectoryDiscovery;
use Drupal\Component\FileCache\FileCacheFactory;
use org\bovigo\vfs\vfsStream;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* YamlDirectoryDiscoveryTest component unit tests.
- *
- * @coversDefaultClass \Drupal\Component\Discovery\YamlDirectoryDiscovery
- *
- * @group Discovery
*/
+#[CoversClass(YamlDirectoryDiscovery::class)]
+#[Group('Discovery')]
class YamlDirectoryDiscoveryTest extends TestCase {
/**
@@ -30,7 +30,7 @@ class YamlDirectoryDiscoveryTest extends TestCase {
/**
* Tests YAML directory discovery.
*
- * @covers ::findAll
+ * @legacy-covers ::findAll
*/
public function testDiscovery(): void {
vfsStream::setup('modules', NULL, [
@@ -102,7 +102,7 @@ class YamlDirectoryDiscoveryTest extends TestCase {
/**
* Tests YAML directory discovery with an alternate ID key.
*
- * @covers ::findAll
+ * @legacy-covers ::findAll
*/
public function testDiscoveryAlternateId(): void {
vfsStream::setup('modules', NULL, [
@@ -124,8 +124,8 @@ class YamlDirectoryDiscoveryTest extends TestCase {
/**
* Tests YAML directory discovery with a missing ID key.
*
- * @covers ::findAll
- * @covers ::getIdentifier
+ * @legacy-covers ::findAll
+ * @legacy-covers ::getIdentifier
*/
public function testDiscoveryNoIdException(): void {
$this->expectException(DiscoveryException::class);
@@ -146,7 +146,7 @@ class YamlDirectoryDiscoveryTest extends TestCase {
/**
* Tests YAML directory discovery with invalid YAML.
*
- * @covers ::findAll
+ * @legacy-covers ::findAll
*/
public function testDiscoveryInvalidYamlException(): void {
$this->expectException(DiscoveryException::class);
diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php
index a592b1cea485..cc662a528cc1 100644
--- a/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDiscoveryTest.php
@@ -10,13 +10,13 @@ use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamWrapper;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* YamlDiscovery component unit tests.
- *
- * @group Discovery
*/
+#[Group('Discovery')]
class YamlDiscoveryTest extends TestCase {
/**
diff --git a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
index 4ffa430c05b5..3e4295e18abf 100644
--- a/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
+++ b/core/tests/Drupal/Tests/Component/DrupalComponentTest.php
@@ -6,13 +6,14 @@ namespace Drupal\Tests\Component;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\AssertionFailedError;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* General tests for \Drupal\Component that can't go anywhere else.
- *
- * @group Component
*/
+#[Group('Component')]
class DrupalComponentTest extends TestCase {
/**
@@ -40,9 +41,8 @@ class DrupalComponentTest extends TestCase {
*
* @param string $component_path
* The path to the component.
- *
- * @dataProvider getComponents
*/
+ #[DataProvider('getComponents')]
public function testComponentLicense(string $component_path): void {
$this->assertFileExists($component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt');
$this->assertSame('e84dac1d9fbb5a4a69e38654ce644cea769aa76b', hash_file('sha1', $component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt'));
@@ -139,9 +139,9 @@ class DrupalComponentTest extends TestCase {
}
/**
- * @covers \Drupal\Tests\Component\DrupalComponentTest::assertNoCoreUsage
- * @dataProvider providerAssertNoCoreUsage
+ * @legacy-covers \Drupal\Tests\Component\DrupalComponentTest::assertNoCoreUsage
*/
+ #[DataProvider('providerAssertNoCoreUsage')]
public function testAssertNoCoreUsage($expected_pass, $file_data): void {
// Set up a virtual file to read.
$vfs_root = vfsStream::setup('root');
diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
index 9cae565db968..503a80c4bb2b 100644
--- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
@@ -5,15 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\FileCache;
use Drupal\Component\FileCache\FileCache;
-use Drupal\Component\FileCache\NullFileCache;
use Drupal\Component\FileCache\FileCacheFactory;
+use Drupal\Component\FileCache\NullFileCache;
use Drupal\Component\Utility\Random;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\FileCache\FileCacheFactory
- * @group FileCache
+ * Tests Drupal\Component\FileCache\FileCacheFactory.
*/
+#[CoversClass(FileCacheFactory::class)]
+#[Group('FileCache')]
class FileCacheFactoryTest extends TestCase {
/**
@@ -36,7 +40,7 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::get
+ * @legacy-covers ::get
*/
public function testGet(): void {
$file_cache = FileCacheFactory::get('test_foo_settings', []);
@@ -57,7 +61,7 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::get
+ * @legacy-covers ::get
*/
public function testGetNoPrefix(): void {
FileCacheFactory::setPrefix(NULL);
@@ -67,7 +71,7 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::get
+ * @legacy-covers ::get
*/
public function testGetDisabledFileCache(): void {
// Ensure the returned FileCache is an instance of FileCache::class.
@@ -84,10 +88,9 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::get
- *
- * @dataProvider configurationDataProvider
+ * @legacy-covers ::get
*/
+ #[DataProvider('configurationDataProvider')]
public function testGetConfigurationOverrides($configuration, $arguments, $class): void {
FileCacheFactory::setConfiguration($configuration);
@@ -154,8 +157,8 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::getConfiguration
- * @covers ::setConfiguration
+ * @legacy-covers ::getConfiguration
+ * @legacy-covers ::setConfiguration
*/
public function testGetSetConfiguration(): void {
$configuration = FileCacheFactory::getConfiguration();
@@ -166,8 +169,8 @@ class FileCacheFactoryTest extends TestCase {
}
/**
- * @covers ::getPrefix
- * @covers ::setPrefix
+ * @legacy-covers ::getPrefix
+ * @legacy-covers ::setPrefix
*/
public function testGetSetPrefix(): void {
// Random generator.
diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
index 88aa8e2f34cd..7128514f6543 100644
--- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
+++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
@@ -5,12 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\FileCache;
use Drupal\Component\FileCache\FileCache;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\FileCache\FileCache
- * @group FileCache
+ * Tests Drupal\Component\FileCache\FileCache.
*/
+#[CoversClass(FileCache::class)]
+#[Group('FileCache')]
class FileCacheTest extends TestCase {
/**
@@ -38,8 +41,8 @@ class FileCacheTest extends TestCase {
}
/**
- * @covers ::get
- * @covers ::__construct
+ * @legacy-covers ::get
+ * @legacy-covers ::__construct
*/
public function testGet(): void {
// Test a cache miss.
@@ -66,7 +69,7 @@ class FileCacheTest extends TestCase {
}
/**
- * @covers ::getMultiple
+ * @legacy-covers ::getMultiple
*/
public function testGetMultiple(): void {
// Test a cache miss.
@@ -101,7 +104,7 @@ class FileCacheTest extends TestCase {
}
/**
- * @covers ::set
+ * @legacy-covers ::set
*/
public function testSet(): void {
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'llama-23.txt';
@@ -122,7 +125,7 @@ class FileCacheTest extends TestCase {
}
/**
- * @covers ::delete
+ * @legacy-covers ::delete
*/
public function testDelete(): void {
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'llama-23.txt';
diff --git a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
index 60cedeb245cb..693194a66a2b 100644
--- a/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
+++ b/core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
@@ -6,18 +6,19 @@ namespace Drupal\Tests\Component\FileSecurity;
use Drupal\Component\FileSecurity\FileSecurity;
use org\bovigo\vfs\vfsStream;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the file security component.
- *
- * @coversDefaultClass \Drupal\Component\FileSecurity\FileSecurity
- * @group FileSecurity
*/
+#[CoversClass(FileSecurity::class)]
+#[Group('FileSecurity')]
class FileSecurityTest extends TestCase {
/**
- * @covers ::writeHtaccess
+ * @legacy-covers ::writeHtaccess
*/
public function testWriteHtaccessPrivate(): void {
vfsStream::setup('root');
@@ -30,7 +31,7 @@ class FileSecurityTest extends TestCase {
}
/**
- * @covers ::writeHtaccess
+ * @legacy-covers ::writeHtaccess
*/
public function testWriteHtaccessPublic(): void {
vfsStream::setup('root');
@@ -43,7 +44,7 @@ class FileSecurityTest extends TestCase {
}
/**
- * @covers ::writeHtaccess
+ * @legacy-covers ::writeHtaccess
*/
public function testWriteHtaccessForceOverwrite(): void {
vfsStream::setup('root');
@@ -56,7 +57,7 @@ class FileSecurityTest extends TestCase {
}
/**
- * @covers ::writeHtaccess
+ * @legacy-covers ::writeHtaccess
*/
public function testWriteHtaccessFailure(): void {
vfsStream::setup('root');
diff --git a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php
index 36749ade6dda..621ce108a5bf 100644
--- a/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php
+++ b/core/tests/Drupal/Tests/Component/FileSystem/RegexDirectoryIteratorTest.php
@@ -6,18 +6,22 @@ namespace Drupal\Tests\Component\FileSystem;
use Drupal\Component\FileSystem\RegexDirectoryIterator;
use org\bovigo\vfs\vfsStream;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\FileSystem\RegexDirectoryIterator
- * @group FileSystem
+ * Tests Drupal\Component\FileSystem\RegexDirectoryIterator.
*/
+#[CoversClass(RegexDirectoryIterator::class)]
+#[Group('FileSystem')]
class RegexDirectoryIteratorTest extends TestCase {
/**
- * @covers ::accept
- * @dataProvider providerTestRegexDirectoryIterator
+ * @legacy-covers ::accept
*/
+ #[DataProvider('providerTestRegexDirectoryIterator')]
public function testRegexDirectoryIterator(array $directory, $regex, array $expected): void {
vfsStream::setup('root', NULL, $directory);
$iterator = new RegexDirectoryIterator(vfsStream::url('root'), $regex);
diff --git a/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php b/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
index 90977d85fb60..618ed88d6fe2 100644
--- a/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
+++ b/core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
@@ -7,15 +7,16 @@ namespace Drupal\Tests\Component\FrontMatter;
use Drupal\Component\FrontMatter\Exception\FrontMatterParseException;
use Drupal\Component\FrontMatter\FrontMatter;
use Drupal\Component\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests front matter parsing helper methods.
- *
- * @group FrontMatter
- *
- * @coversDefaultClass \Drupal\Component\FrontMatter\FrontMatter
*/
+#[CoversClass(FrontMatter::class)]
+#[Group('FrontMatter')]
class FrontMatterTest extends TestCase {
/**
@@ -47,8 +48,8 @@ class FrontMatterTest extends TestCase {
/**
* Tests when a passed serializer doesn't implement the proper interface.
*
- * @covers ::__construct
- * @covers ::create
+ * @legacy-covers ::__construct
+ * @legacy-covers ::create
*/
public function testFrontMatterSerializerException(): void {
$this->expectException(\AssertionError::class);
@@ -59,10 +60,10 @@ class FrontMatterTest extends TestCase {
/**
* Tests broken front matter.
*
- * @covers ::__construct
- * @covers ::create
- * @covers ::parse
- * @covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException
+ * @legacy-covers ::__construct
+ * @legacy-covers ::create
+ * @legacy-covers ::parse
+ * @legacy-covers \Drupal\Component\FrontMatter\Exception\FrontMatterParseException
*/
public function testFrontMatterBroken(): void {
$this->expectException(FrontMatterParseException::class);
@@ -81,15 +82,14 @@ class FrontMatterTest extends TestCase {
* @param string $content
* The content to use for testing purposes.
*
- * @covers ::__construct
- * @covers ::getContent
- * @covers ::getData
- * @covers ::getLine
- * @covers ::create
- * @covers ::parse
- *
- * @dataProvider providerFrontMatterData
+ * @legacy-covers ::__construct
+ * @legacy-covers ::getContent
+ * @legacy-covers ::getData
+ * @legacy-covers ::getLine
+ * @legacy-covers ::create
+ * @legacy-covers ::parse
*/
+ #[DataProvider('providerFrontMatterData')]
public function testFrontMatterData($yaml, $line, $content = self::SOURCE): void {
$source = static::createFrontMatterSource($yaml, $content);
$frontMatter = FrontMatter::create($source);
diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
index d5c97bdb8c7e..14797ad4b3b7 100644
--- a/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
+++ b/core/tests/Drupal/Tests/Component/Gettext/PoHeaderTest.php
@@ -5,15 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Gettext;
use Drupal\Component\Gettext\PoHeader;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Unit tests for the Gettext PO file header handling features.
*
* @see Drupal\Component\Gettext\PoHeader.
- *
- * @group Gettext
*/
+#[Group('Gettext')]
class PoHeaderTest extends TestCase {
/**
@@ -26,9 +27,8 @@ class PoHeaderTest extends TestCase {
* The plural expression.
* @param array $expected
* Array of expected plural positions keyed by plural value.
- *
- * @dataProvider providerTestPluralsFormula
*/
+ #[DataProvider('providerTestPluralsFormula')]
public function testPluralsFormula($plural, $expected): void {
$p = new PoHeader();
[, $new_plural] = $p->parsePluralForms($plural);
diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php
index 7026a2ceac5a..d8890bac7799 100644
--- a/core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php
+++ b/core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Gettext;
use Drupal\Component\Gettext\PoItem;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Gettext\PoItem
- * @group Gettext
+ * Tests Drupal\Component\Gettext\PoItem.
*/
+#[CoversClass(PoItem::class)]
+#[Group('Gettext')]
class PoItemTest extends TestCase {
/**
@@ -61,9 +65,7 @@ class PoItemTest extends TestCase {
// cSpell:enable
}
- /**
- * @dataProvider providerStrings
- */
+ #[DataProvider('providerStrings')]
public function testFormat($source, $context, $translation, $expected): void {
$item = new PoItem();
diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php
index 667c2129770a..d38147f21ed6 100644
--- a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php
+++ b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php
@@ -9,13 +9,17 @@ use Drupal\Component\Gettext\PoItem;
use Drupal\Component\Gettext\PoStreamWriter;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamFile;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
/**
- * @coversDefaultClass \Drupal\Component\Gettext\PoStreamWriter
- * @group Gettext
+ * Tests Drupal\Component\Gettext\PoStreamWriter.
*/
+#[CoversClass(PoStreamWriter::class)]
+#[Group('Gettext')]
class PoStreamWriterTest extends TestCase {
use ProphecyTrait;
@@ -51,7 +55,7 @@ class PoStreamWriterTest extends TestCase {
}
/**
- * @covers ::getURI
+ * @legacy-covers ::getURI
*/
public function testGetUriException(): void {
$this->expectException(\Exception::class);
@@ -61,9 +65,9 @@ class PoStreamWriterTest extends TestCase {
}
/**
- * @covers ::writeItem
- * @dataProvider providerWriteData
+ * @legacy-covers ::writeItem
*/
+ #[DataProvider('providerWriteData')]
public function testWriteItem($poContent, $expected, $long): void {
if ($long) {
$this->expectException(\Exception::class);
@@ -105,7 +109,7 @@ class PoStreamWriterTest extends TestCase {
}
/**
- * @covers ::close
+ * @legacy-covers ::close
*/
public function testCloseException(): void {
$this->expectException(\Exception::class);
diff --git a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
index 61002b0199b3..cd0f46a3a1a9 100644
--- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
+++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
@@ -5,12 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Graph;
use Drupal\Component\Graph\Graph;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Graph\Graph
- * @group Graph
+ * Tests Drupal\Component\Graph\Graph.
*/
+#[CoversClass(Graph::class)]
+#[Group('Graph')]
class GraphTest extends TestCase {
/**
diff --git a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php
index 4fa007b1121c..5c5fc82e6339 100644
--- a/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php
+++ b/core/tests/Drupal/Tests/Component/HttpFoundation/SecuredRedirectResponseTest.php
@@ -5,23 +5,24 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\HttpFoundation;
use Drupal\Component\HttpFoundation\SecuredRedirectResponse;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Test secure redirect base class.
- *
- * @group Routing
- * @coversDefaultClass \Drupal\Component\HttpFoundation\SecuredRedirectResponse
*/
+#[CoversClass(SecuredRedirectResponse::class)]
+#[Group('Routing')]
class SecuredRedirectResponseTest extends TestCase {
/**
* Tests copying of redirect response.
*
- * @covers ::createFromRedirectResponse
- * @covers ::fromResponse
+ * @legacy-covers ::createFromRedirectResponse
+ * @legacy-covers ::fromResponse
*/
public function testRedirectCopy(): void {
$redirect = new RedirectResponse('/magic_redirect_url', 301, ['x-cache-foobar' => 123]);
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
index 4d4c56ef1ebf..e1c05c7111cd 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageReadOnlyTest.php
@@ -4,17 +4,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\PhpStorage;
-use Drupal\Component\PhpStorage\FileStorage;
use Drupal\Component\PhpStorage\FileReadOnlyStorage;
+use Drupal\Component\PhpStorage\FileStorage;
use Drupal\Component\Utility\Random;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @coversDefaultClass \Drupal\Component\PhpStorage\FileReadOnlyStorage
- *
- * @group Drupal
- * @group PhpStorage
+ * Tests Drupal\Component\PhpStorage\FileReadOnlyStorage.
*/
+#[CoversClass(FileReadOnlyStorage::class)]
+#[Group('Drupal')]
+#[Group('PhpStorage')]
class FileStorageReadOnlyTest extends PhpStorageTestBase {
use ExpectDeprecationTrait;
@@ -83,7 +85,7 @@ class FileStorageReadOnlyTest extends PhpStorageTestBase {
}
/**
- * @covers ::deleteAll
+ * @legacy-covers ::deleteAll
*/
public function testDeleteAll(): void {
// Random generator.
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
index bc0d8e5e908e..e24013cfcc79 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php
@@ -8,12 +8,15 @@ use Drupal\Component\PhpStorage\FileStorage;
use Drupal\Component\Utility\Random;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
use org\bovigo\vfs\vfsStreamDirectory;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @coversDefaultClass \Drupal\Component\PhpStorage\FileStorage
- * @group Drupal
- * @group PhpStorage
+ * Tests Drupal\Component\PhpStorage\FileStorage.
*/
+#[CoversClass(FileStorage::class)]
+#[Group('Drupal')]
+#[Group('PhpStorage')]
class FileStorageTest extends PhpStorageTestBase {
use ExpectDeprecationTrait;
@@ -40,10 +43,10 @@ class FileStorageTest extends PhpStorageTestBase {
/**
* Tests basic load/save/delete operations.
*
- * @covers ::load
- * @covers ::save
- * @covers ::exists
- * @covers ::delete
+ * @legacy-covers ::load
+ * @legacy-covers ::save
+ * @legacy-covers ::exists
+ * @legacy-covers ::delete
*/
public function testCRUD(): void {
$php = new FileStorage($this->standardSettings);
@@ -51,7 +54,7 @@ class FileStorageTest extends PhpStorageTestBase {
}
/**
- * @covers ::deleteAll
+ * @legacy-covers ::deleteAll
*/
public function testDeleteAll(): void {
// Random generator.
@@ -86,7 +89,7 @@ class FileStorageTest extends PhpStorageTestBase {
}
/**
- * @covers ::createDirectory
+ * @legacy-covers ::createDirectory
*/
public function testCreateDirectoryFailWarning(): void {
$directory = new vfsStreamDirectory('permissionDenied', 0200);
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php
index 6e65e0ca8dde..90896b95a173 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php
@@ -4,14 +4,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\PhpStorage;
+use Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests the MTimeProtectedFastFileStorage implementation.
- *
- * @coversDefaultClass \Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage
- *
- * @group Drupal
- * @group PhpStorage
*/
+#[CoversClass(MTimeProtectedFastFileStorage::class)]
+#[Group('Drupal')]
+#[Group('PhpStorage')]
class MTimeProtectedFastFileStorageTest extends MTimeProtectedFileStorageBase {
/**
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
index e2fea54aeb13..20adb60eb9e8 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php
@@ -7,10 +7,12 @@ namespace Drupal\Tests\Component\PhpStorage;
use Drupal\Component\FileSecurity\FileSecurity;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Random;
+use PHPUnit\Framework\Attributes\Medium;
/**
* Base test class for MTime protected storage.
*/
+#[Medium]
abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
/**
@@ -74,8 +76,6 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
* mtime too.
*
* We need to delay over 1 second for mtime test.
- *
- * @medium
*/
public function testSecurity(): void {
$php = new $this->storageClass($this->settings);
diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php
index 0abed0e1233d..b58c6508af6b 100644
--- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php
+++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php
@@ -4,14 +4,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\PhpStorage;
+use Drupal\Component\PhpStorage\MTimeProtectedFileStorage;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests the MTimeProtectedFileStorage implementation.
- *
- * @coversDefaultClass \Drupal\Component\PhpStorage\MTimeProtectedFileStorage
- *
- * @group Drupal
- * @group PhpStorage
*/
+#[CoversClass(MTimeProtectedFileStorage::class)]
+#[Group('Drupal')]
+#[Group('PhpStorage')]
class MTimeProtectedFileStorageTest extends MTimeProtectedFileStorageBase {
/**
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php
index 1dfa467e5998..e43a2c3ce367 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeBaseTest.php
@@ -5,17 +5,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Attribute;
use Drupal\Component\Plugin\Attribute\AttributeBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Attribute\AttributeBase
- * @group Attribute
+ * Tests Drupal\Component\Plugin\Attribute\AttributeBase.
*/
+#[CoversClass(AttributeBase::class)]
+#[Group('Attribute')]
class AttributeBaseTest extends TestCase {
/**
- * @covers ::getProvider
- * @covers ::setProvider
+ * @legacy-covers ::getProvider
+ * @legacy-covers ::setProvider
*/
public function testSetProvider(): void {
$plugin = new AttributeBaseStub(id: '1');
@@ -24,7 +27,7 @@ class AttributeBaseTest extends TestCase {
}
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$plugin = new AttributeBaseStub(id: 'example');
@@ -32,8 +35,8 @@ class AttributeBaseTest extends TestCase {
}
/**
- * @covers ::getClass
- * @covers ::setClass
+ * @legacy-covers ::getClass
+ * @legacy-covers ::setClass
*/
public function testSetClass(): void {
$plugin = new AttributeBaseStub(id: '1');
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php
index 92cd1ff1ef81..9fcb6a8f59f5 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryCachedTest.php
@@ -5,16 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Attribute;
use Composer\Autoload\ClassLoader;
-use Drupal\Component\Plugin\Discovery\AttributeClassDiscovery;
use Drupal\Component\FileCache\FileCacheFactory;
+use Drupal\Component\Plugin\Discovery\AttributeClassDiscovery;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery
- * @covers \Drupal\Component\Discovery\MissingClassDetectionClassLoader
- * @group Attribute
- * @runTestsInSeparateProcesses
+ * @legacy-covers \Drupal\Component\Discovery\MissingClassDetectionClassLoader
*/
+#[CoversClass(AttributeClassDiscovery::class)]
+#[Group('Attribute')]
+#[RunTestsInSeparateProcesses]
class AttributeClassDiscoveryCachedTest extends TestCase {
/**
@@ -40,7 +43,7 @@ class AttributeClassDiscoveryCachedTest extends TestCase {
/**
* Tests that getDefinitions() retrieves the file cache correctly.
*
- * @covers ::getDefinitions
+ * @legacy-covers ::getDefinitions
*/
public function testGetDefinitions(): void {
// Path to the classes which we'll discover and parse annotation.
@@ -100,7 +103,7 @@ class AttributeClassDiscoveryCachedTest extends TestCase {
/**
* Tests discovery with missing traits.
*
- * @covers ::getDefinitions
+ * @legacy-covers ::getDefinitions
*/
public function testGetDefinitionsMissingTrait(): void {
// Path to the classes which we'll discover and parse annotation.
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php
index aa20f8146f8e..be0664d1f198 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/AttributeClassDiscoveryTest.php
@@ -5,15 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Attribute;
use Composer\Autoload\ClassLoader;
-use Drupal\Component\Plugin\Discovery\AttributeClassDiscovery;
use Drupal\Component\FileCache\FileCacheFactory;
+use Drupal\Component\Plugin\Discovery\AttributeClassDiscovery;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery
- * @group Attribute
- * @runTestsInSeparateProcesses
+ * Tests Drupal\Component\Plugin\Discovery\AttributeClassDiscovery.
*/
+#[CoversClass(AttributeClassDiscovery::class)]
+#[Group('Attribute')]
+#[RunTestsInSeparateProcesses]
class AttributeClassDiscoveryTest extends TestCase {
/**
@@ -36,8 +40,8 @@ class AttributeClassDiscoveryTest extends TestCase {
}
/**
- * @covers ::__construct
- * @covers ::getPluginNamespaces
+ * @legacy-covers ::__construct
+ * @legacy-covers ::getPluginNamespaces
*/
public function testGetPluginNamespaces(): void {
// Path to the classes which we'll discover and parse annotation.
@@ -51,8 +55,8 @@ class AttributeClassDiscoveryTest extends TestCase {
}
/**
- * @covers ::getDefinitions
- * @covers ::prepareAttributeDefinition
+ * @legacy-covers ::getDefinitions
+ * @legacy-covers ::prepareAttributeDefinition
*/
public function testGetDefinitions(): void {
$discovery = new AttributeClassDiscovery(['com\example' => [__DIR__ . "/../../../../../fixtures/plugins/Plugin"]]);
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php
index 2791af3d3f7b..0d1fbb93e6e5 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php
@@ -5,16 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Attribute;
use Drupal\Component\Plugin\Attribute\PluginID;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Attribute\PluginID
- * @group Attribute
+ * Tests Drupal\Component\Plugin\Attribute\PluginID.
*/
+#[CoversClass(PluginID::class)]
+#[Group('Attribute')]
class PluginIdTest extends TestCase {
/**
- * @covers ::get
+ * @legacy-covers ::get
*/
public function testGet(): void {
// Assert plugin starts with only an ID.
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php
index 5cad2a940673..d241d5509fb3 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php
@@ -5,17 +5,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Attribute;
use Drupal\Component\Plugin\Attribute\Plugin;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Attribute\Plugin
- * @group Attribute
+ * Tests Drupal\Component\Plugin\Attribute\Plugin.
*/
+#[CoversClass(Plugin::class)]
+#[Group('Attribute')]
class PluginTest extends TestCase {
/**
- * @covers ::__construct
- * @covers ::get
+ * @legacy-covers ::__construct
+ * @legacy-covers ::get
*/
public function testGet(): void {
$plugin = new PluginStub(id: 'example', deriver: 'test');
@@ -28,8 +31,8 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::setProvider
- * @covers ::getProvider
+ * @legacy-covers ::setProvider
+ * @legacy-covers ::getProvider
*/
public function testSetProvider(): void {
$plugin = new Plugin(id: 'example');
@@ -38,7 +41,7 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::getId
+ * @legacy-covers ::getId
*/
public function testGetId(): void {
$plugin = new Plugin(id: 'example');
@@ -46,8 +49,8 @@ class PluginTest extends TestCase {
}
/**
- * @covers ::setClass
- * @covers ::getClass
+ * @legacy-covers ::setClass
+ * @legacy-covers ::getClass
*/
public function testSetClass(): void {
$plugin = new Plugin(id: 'test');
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
index 6004e705acf8..fe5413c505f5 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Context/ContextTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Context;
use Drupal\Component\Plugin\Context\Context;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Context\Context
- * @group Plugin
+ * Tests Drupal\Component\Plugin\Context\Context.
*/
+#[CoversClass(Context::class)]
+#[Group('Plugin')]
class ContextTest extends TestCase {
/**
@@ -25,9 +29,9 @@ class ContextTest extends TestCase {
}
/**
- * @covers ::getContextValue
- * @dataProvider providerGetContextValue
+ * @legacy-covers ::getContextValue
*/
+ #[DataProvider('providerGetContextValue')]
public function testGetContextValue($expected, $context_value, $is_required, $data_type): void {
// Mock a Context object.
$mock_context = $this->getMockBuilder('Drupal\Component\Plugin\Context\Context')
@@ -97,9 +101,9 @@ class ContextTest extends TestCase {
}
/**
- * @covers ::hasContextValue
- * @dataProvider providerHasContextValue
+ * @legacy-covers ::hasContextValue
*/
+ #[DataProvider('providerHasContextValue')]
public function testHasContextValue($has_context_value, $default_value): void {
$mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface');
@@ -114,7 +118,7 @@ class ContextTest extends TestCase {
}
/**
- * @covers ::getContextValue
+ * @legacy-covers ::getContextValue
*/
public function testDefaultValue(): void {
$mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface');
diff --git a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
index f92d274cd858..16fa9ad86c4b 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
@@ -10,18 +10,21 @@ use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Tests\Component\Plugin\Fixtures\vegetable\Broccoli;
use Drupal\Tests\Component\Plugin\Fixtures\vegetable\Corn;
use Drupal\Tests\Component\Plugin\Fixtures\vegetable\VegetableInterface;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Factory\DefaultFactory
- * @group Plugin
+ * Tests Drupal\Component\Plugin\Factory\DefaultFactory.
*/
+#[CoversClass(DefaultFactory::class)]
+#[Group('Plugin')]
class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a valid array plugin definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithValidArrayPluginDefinition(): void {
$plugin_class = Corn::class;
@@ -33,7 +36,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a valid object plugin definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithValidObjectPluginDefinition(): void {
$plugin_class = Corn::class;
@@ -49,7 +52,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a missing class definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithMissingClassWithArrayPluginDefinition(): void {
$this->expectException(PluginException::class);
@@ -60,7 +63,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a missing class definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithMissingClassWithObjectPluginDefinition(): void {
$plugin_definition = $this->getMockBuilder(PluginDefinitionInterface::class)
@@ -73,7 +76,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a non-existent class definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithNotExistingClassWithArrayPluginDefinition(): void {
$this->expectException(PluginException::class);
@@ -84,7 +87,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a non-existent class definition.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithNotExistingClassWithObjectPluginDefinition(): void {
$plugin_class = 'Drupal\Tests\Component\Plugin\Fixtures\vegetable\Carrot';
@@ -99,7 +102,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a required interface.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithInterfaceWithArrayPluginDefinition(): void {
$plugin_class = Corn::class;
@@ -111,7 +114,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a required interface.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithInterfaceWithObjectPluginDefinition(): void {
$plugin_class = Corn::class;
@@ -127,7 +130,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a required interface but no implementation.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithInterfaceAndInvalidClassWithArrayPluginDefinition(): void {
$this->expectException(PluginException::class);
@@ -138,7 +141,7 @@ class DefaultFactoryTest extends TestCase {
/**
* Tests getPluginClass() with a required interface but no implementation.
*
- * @covers ::getPluginClass
+ * @legacy-covers ::getPluginClass
*/
public function testGetPluginClassWithInterfaceAndInvalidClassWithObjectPluginDefinition(): void {
$plugin_class = Broccoli::class;
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
index 483764b3c0ea..8b632acae002 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
@@ -9,14 +9,18 @@ use Drupal\Component\FileCache\FileCacheFactory;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamWrapper;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\CoversNothing;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery
- *
- * @group Annotation
- * @group Plugin
+ * Tests Drupal\Component\Annotation\Plugin\Discovery\AnnotatedClassDiscovery.
*/
+#[CoversClass(AnnotatedClassDiscovery::class)]
+#[Group('Annotation')]
+#[Group('Plugin')]
class AnnotatedClassDiscoveryTest extends TestCase {
/**
@@ -53,11 +57,9 @@ class AnnotatedClassDiscoveryTest extends TestCase {
/**
* Make sure AnnotatedClassDiscovery never tries to autoload bad annotations.
- *
- * @dataProvider provideBadAnnotations
- *
- * @coversNothing
*/
+ #[CoversNothing]
+ #[DataProvider('provideBadAnnotations')]
public function testAutoloadBadAnnotations($annotation): void {
// Set up a class file in vfsStream.
vfsStreamWrapper::register();
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
index cc8d2aabcee9..a85c01c7ee63 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
@@ -4,20 +4,24 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Discovery;
+use Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator;
use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Component\Plugin\Definition\PluginDefinition;
use Drupal\Component\Plugin\Discovery\AttributeBridgeDecorator;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator
- * @group Plugin
+ * Tests Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator.
*/
+#[CoversClass(AnnotationBridgeDecorator::class)]
+#[Group('Plugin')]
class AttributeBridgeDecoratorTest extends TestCase {
/**
- * @covers ::getDefinitions
+ * @legacy-covers ::getDefinitions
*/
public function testGetDefinitions(): void {
// Normally the attribute classes would be autoloaded.
@@ -47,7 +51,7 @@ class AttributeBridgeDecoratorTest extends TestCase {
/**
* Tests that the decorator of other methods works.
*
- * @covers ::__call
+ * @legacy-covers ::__call
*/
public function testOtherMethod(): void {
// Normally the attribute classes would be autoloaded.
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
index 9db89444c171..3368c9a14ab6 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryCachedTraitTest.php
@@ -5,13 +5,19 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Discovery;
use Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait;
+use Drupal\Component\Plugin\Discovery\DiscoveryTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait
- * @uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
- * @group Plugin
+ * Tests Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.
*/
+#[CoversClass(DiscoveryCachedTrait::class)]
+#[Group('Plugin')]
+#[UsesClass(DiscoveryTrait::class)]
class DiscoveryCachedTraitTest extends TestCase {
/**
@@ -32,9 +38,9 @@ class DiscoveryCachedTraitTest extends TestCase {
}
/**
- * @covers ::getDefinition
- * @dataProvider providerGetDefinition
+ * @legacy-covers ::getDefinition
*/
+ #[DataProvider('providerGetDefinition')]
public function testGetDefinition($expected, $cached_definitions, $get_definitions, $plugin_id): void {
$trait = $this->getMockBuilder(DiscoveryCachedTraitMockableClass::class)
->onlyMethods(['getDefinitions'])
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
index d26a538aad62..f85eeeb193cc 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
@@ -6,12 +6,19 @@ namespace Drupal\Tests\Component\Plugin\Discovery;
use Drupal\Component\Plugin\Discovery\DiscoveryTrait;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;
/**
- * @group Plugin
- * @coversDefaultClass \Drupal\Component\Plugin\Discovery\DiscoveryTrait
+ * Tests Drupal\Component\Plugin\Discovery\DiscoveryTrait.
*/
+#[CoversClass(DiscoveryTrait::class)]
+#[Group('Plugin')]
+#[UsesClass(PluginNotFoundException::class)]
+#[UsesClass(PluginNotFoundException::class)]
class DiscoveryTraitTest extends TestCase {
/**
@@ -30,9 +37,9 @@ class DiscoveryTraitTest extends TestCase {
}
/**
- * @covers ::doGetDefinition
- * @dataProvider providerDoGetDefinition
+ * @legacy-covers ::doGetDefinition
*/
+ #[DataProvider('providerDoGetDefinition')]
public function testDoGetDefinition($expected, $definitions, $plugin_id): void {
$trait = new DiscoveryTraitMockableClass();
// Un-protect the method using reflection.
@@ -59,10 +66,9 @@ class DiscoveryTraitTest extends TestCase {
}
/**
- * @covers ::doGetDefinition
- * @dataProvider providerDoGetDefinitionException
- * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @legacy-covers ::doGetDefinition
*/
+ #[DataProvider('providerDoGetDefinitionException')]
public function testDoGetDefinitionException($expected, $definitions, $plugin_id): void {
$trait = new DiscoveryTraitMockableClass();
// Un-protect the method using reflection.
@@ -73,9 +79,9 @@ class DiscoveryTraitTest extends TestCase {
}
/**
- * @covers ::getDefinition
- * @dataProvider providerDoGetDefinition
+ * @legacy-covers ::getDefinition
*/
+ #[DataProvider('providerDoGetDefinition')]
public function testGetDefinition($expected, $definitions, $plugin_id): void {
// Since getDefinition is a wrapper around doGetDefinition(), we can re-use
// its data provider. We just have to tell abstract method getDefinitions()
@@ -94,10 +100,9 @@ class DiscoveryTraitTest extends TestCase {
}
/**
- * @covers ::getDefinition
- * @dataProvider providerDoGetDefinitionException
- * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
+ * @legacy-covers ::getDefinition
*/
+ #[DataProvider('providerDoGetDefinitionException')]
public function testGetDefinitionException($expected, $definitions, $plugin_id): void {
// Since getDefinition is a wrapper around doGetDefinition(), we can re-use
// its data provider. We just have to tell abstract method getDefinitions()
@@ -128,9 +133,9 @@ class DiscoveryTraitTest extends TestCase {
}
/**
- * @covers ::hasDefinition
- * @dataProvider providerHasDefinition
+ * @legacy-covers ::hasDefinition
*/
+ #[DataProvider('providerHasDefinition')]
public function testHasDefinition($expected, $plugin_id): void {
$trait = $this->getMockBuilder(DiscoveryTraitMockableClass::class)
->onlyMethods(['getDefinition'])
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
index b2f430416a77..2de43953ea0a 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
@@ -7,12 +7,16 @@ namespace Drupal\Tests\Component\Plugin\Discovery;
use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\Component\Plugin\Discovery\StaticDiscovery;
use Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @group Plugin
- * @coversDefaultClass \Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator
+ * Tests Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator.
*/
+#[CoversClass(StaticDiscoveryDecorator::class)]
+#[Group('Plugin')]
class StaticDiscoveryDecoratorTest extends TestCase {
/**
@@ -58,9 +62,9 @@ class StaticDiscoveryDecoratorTest extends TestCase {
}
/**
- * @covers ::getDefinition
- * @dataProvider providerGetDefinition
+ * @legacy-covers ::getDefinition
*/
+ #[DataProvider('providerGetDefinition')]
public function testGetDefinition($expected, $has_register_definitions, $exception_on_invalid, $definitions, $base_plugin_id): void {
// Mock our StaticDiscoveryDecorator.
$mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class)
@@ -123,9 +127,9 @@ class StaticDiscoveryDecoratorTest extends TestCase {
}
/**
- * @covers ::getDefinitions
- * @dataProvider providerGetDefinitions
+ * @legacy-covers ::getDefinitions
*/
+ #[DataProvider('providerGetDefinitions')]
public function testGetDefinitions($has_register_definitions, $definitions): void {
// Mock our StaticDiscoveryDecorator.
$mock_decorator = $this->getMockBuilder(StaticDiscoveryDecorator::class)
@@ -186,9 +190,9 @@ class StaticDiscoveryDecoratorTest extends TestCase {
}
/**
- * @covers ::__call
- * @dataProvider providerCall
+ * @legacy-covers ::__call
*/
+ #[DataProvider('providerCall')]
public function testCall($method, $args): void {
// Mock a decorated object.
$mock_decorated = $this->getMockBuilder(StaticDiscoveryTestDecoratedClass::class)
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
index 860c96c6e22a..282b2f4edf37 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Plugin\Factory;
use Drupal\Component\Plugin\Factory\ReflectionFactory;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @group Plugin
- * @coversDefaultClass \Drupal\Component\Plugin\Factory\ReflectionFactory
+ * Tests Drupal\Component\Plugin\Factory\ReflectionFactory.
*/
+#[CoversClass(ReflectionFactory::class)]
+#[Group('Plugin')]
class ReflectionFactoryTest extends TestCase {
/**
@@ -77,9 +81,9 @@ class ReflectionFactoryTest extends TestCase {
}
/**
- * @covers ::createInstance
- * @dataProvider providerGetInstanceArguments
+ * @legacy-covers ::createInstance
*/
+ #[DataProvider('providerGetInstanceArguments')]
public function testCreateInstance($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration): void {
// Create a mock DiscoveryInterface which can return our plugin definition.
$mock_discovery = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
@@ -102,9 +106,9 @@ class ReflectionFactoryTest extends TestCase {
}
/**
- * @covers ::getInstanceArguments
- * @dataProvider providerGetInstanceArguments
+ * @legacy-covers ::getInstanceArguments
*/
+ #[DataProvider('providerGetInstanceArguments')]
public function testGetInstanceArguments($expected, $reflector_name, $plugin_id, $plugin_definition, $configuration): void {
$reflection_factory = $this->getMockBuilder('Drupal\Component\Plugin\Factory\ReflectionFactory')
->disableOriginalConstructor()
diff --git a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
index 9842f252a839..d4bd2ff757de 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php
@@ -6,13 +6,17 @@ namespace Drupal\Tests\Component\Plugin;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Plugin\Mapper\MapperInterface;
+use Drupal\Component\Plugin\PluginManagerBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
/**
- * @coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase
- * @group Plugin
+ * Tests Drupal\Component\Plugin\PluginManagerBase.
*/
+#[CoversClass(PluginManagerBase::class)]
+#[Group('Plugin')]
class PluginManagerBaseTest extends TestCase {
use ProphecyTrait;
@@ -47,7 +51,7 @@ class PluginManagerBaseTest extends TestCase {
/**
* Tests createInstance() with no fallback methods.
*
- * @covers ::createInstance
+ * @legacy-covers ::createInstance
*/
public function testCreateInstance(): void {
$manager = new StubPluginManagerBase();
@@ -66,7 +70,7 @@ class PluginManagerBaseTest extends TestCase {
/**
* Tests createInstance() with a fallback method.
*
- * @covers ::createInstance
+ * @legacy-covers ::createInstance
*/
public function testCreateInstanceFallback(): void {
// We use our special stub class which extends PluginManagerBase and also
@@ -92,7 +96,7 @@ class PluginManagerBaseTest extends TestCase {
}
/**
- * @covers ::getInstance
+ * @legacy-covers ::getInstance
*/
public function testGetInstance(): void {
$options = [
@@ -109,7 +113,7 @@ class PluginManagerBaseTest extends TestCase {
}
/**
- * @covers ::getInstance
+ * @legacy-covers ::getInstance
*/
public function testGetInstanceWithoutMapperShouldThrowException(): void {
$options = [
diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
index 5545b2e01409..26ab691bf1af 100644
--- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
+++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
@@ -5,12 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\ProxyBuilder;
use Drupal\Component\ProxyBuilder\ProxyBuilder;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\ProxyBuilder\ProxyBuilder
- * @group proxy_builder
+ * Tests Drupal\Component\ProxyBuilder\ProxyBuilder.
*/
+#[CoversClass(ProxyBuilder::class)]
+#[Group('proxy_builder')]
class ProxyBuilderTest extends TestCase {
/**
@@ -30,7 +33,7 @@ class ProxyBuilderTest extends TestCase {
}
/**
- * @covers ::buildProxyClassName
+ * @legacy-covers ::buildProxyClassName
*/
public function testBuildProxyClassName(): void {
$class_name = $this->proxyBuilder->buildProxyClassName('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod');
@@ -38,7 +41,7 @@ class ProxyBuilderTest extends TestCase {
}
/**
- * @covers ::buildProxyClassName
+ * @legacy-covers ::buildProxyClassName
*/
public function testBuildProxyClassNameForModule(): void {
$class_name = $this->proxyBuilder->buildProxyClassName('Drupal\views_ui\ParamConverter\ViewUIConverter');
@@ -46,7 +49,7 @@ class ProxyBuilderTest extends TestCase {
}
/**
- * @covers ::buildProxyNamespace
+ * @legacy-covers ::buildProxyNamespace
*/
public function testBuildProxyNamespace(): void {
$class_name = $this->proxyBuilder->buildProxyNamespace('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod');
@@ -56,9 +59,9 @@ class ProxyBuilderTest extends TestCase {
/**
* Tests the basic methods like the constructor and the lazyLoadItself method.
*
- * @covers ::build
- * @covers ::buildConstructorMethod
- * @covers ::buildLazyLoadItselfMethod
+ * @legacy-covers ::build
+ * @legacy-covers ::buildConstructorMethod
+ * @legacy-covers ::buildLazyLoadItselfMethod
*/
public function testBuildNoMethod(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod';
@@ -68,8 +71,8 @@ class ProxyBuilderTest extends TestCase {
}
/**
- * @covers ::buildMethod
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildSimpleMethod(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceSimpleMethod';
@@ -91,9 +94,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildMethodWithParameter(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceMethodWithParameter';
@@ -115,9 +118,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildComplexMethod(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceComplexMethod';
@@ -142,7 +145,7 @@ EOS;
}
/**
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildServiceMethodReturnsVoid(): void {
$class = TestServiceMethodReturnsVoid::class;
@@ -166,8 +169,8 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildReturnReference(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceReturnReference';
@@ -191,9 +194,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildWithInterface(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithInterface';
@@ -217,7 +220,7 @@ EOS;
}
/**
- * @covers ::build
+ * @legacy-covers ::build
*/
public function testBuildWithNestedInterface(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithChildInterfaces';
@@ -230,9 +233,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildWithProtectedAndPrivateMethod(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithProtectedMethods';
@@ -255,9 +258,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildWithPublicStaticMethod(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod';
@@ -281,9 +284,9 @@ EOS;
}
/**
- * @covers ::buildMethod
- * @covers ::buildParameter
- * @covers ::buildMethodBody
+ * @legacy-covers ::buildMethod
+ * @legacy-covers ::buildParameter
+ * @legacy-covers ::buildMethodBody
*/
public function testBuildWithNullableSelfTypeHint(): void {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNullableTypeHintSelf';
diff --git a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php
index 5e82b2daaef1..4547de6b9d39 100644
--- a/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php
+++ b/core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php
@@ -6,14 +6,16 @@ namespace Drupal\Tests\Component\Render;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the TranslatableMarkup class.
- *
- * @coversDefaultClass \Drupal\Component\Render\FormattableMarkup
- * @group utility
*/
+#[CoversClass(FormattableMarkup::class)]
+#[Group('utility')]
class FormattableMarkupTest extends TestCase {
use ExpectDeprecationTrait;
@@ -33,8 +35,8 @@ class FormattableMarkupTest extends TestCase {
protected $lastErrorNumber;
/**
- * @covers ::__toString
- * @covers ::jsonSerialize
+ * @legacy-covers ::__toString
+ * @legacy-covers ::jsonSerialize
*/
public function testToString(): void {
$string = 'Can I have a @replacement';
@@ -46,7 +48,7 @@ class FormattableMarkupTest extends TestCase {
}
/**
- * @covers ::count
+ * @legacy-covers ::count
*/
public function testCount(): void {
$string = 'Can I have a @replacement';
@@ -72,9 +74,9 @@ class FormattableMarkupTest extends TestCase {
}
/**
- * @covers ::__toString
- * @dataProvider providerTestUnexpectedPlaceholder
+ * @legacy-covers ::__toString
*/
+ #[DataProvider('providerTestUnexpectedPlaceholder')]
public function testUnexpectedPlaceholder($string, $arguments, $error_number, $error_message): void {
// We set a custom error handler because of
// https://github.com/sebastianbergmann/phpunit/issues/487
diff --git a/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php b/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php
index 2b10bbfbd79f..ff5e407d81b0 100644
--- a/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php
+++ b/core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php
@@ -6,23 +6,24 @@ namespace Drupal\Tests\Component\Render;
use Drupal\Component\Render\HtmlEscapedText;
use Drupal\Component\Render\MarkupInterface;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophet;
/**
* Tests the HtmlEscapedText class.
- *
- * @coversDefaultClass \Drupal\Component\Render\HtmlEscapedText
- * @group utility
*/
+#[CoversClass(HtmlEscapedText::class)]
+#[Group('utility')]
class HtmlEscapedTextTest extends TestCase {
/**
- * @covers ::__toString
- * @covers ::jsonSerialize
- *
- * @dataProvider providerToString
+ * @legacy-covers ::__toString
+ * @legacy-covers ::jsonSerialize
*/
+ #[DataProvider('providerToString')]
public function testToString($text, $expected, $message): void {
$escapable_string = new HtmlEscapedText($text);
$this->assertEquals($expected, (string) $escapable_string, $message);
@@ -58,7 +59,7 @@ class HtmlEscapedTextTest extends TestCase {
}
/**
- * @covers ::count
+ * @legacy-covers ::count
*/
public function testCount(): void {
$string = 'Can I have a <em>kitten</em>';
diff --git a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
index 21e8830fa89c..57d09fddc83d 100644
--- a/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
+++ b/core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php
@@ -4,16 +4,20 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Render;
-use Drupal\Component\Render\PlainTextOutput;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Render\MarkupInterface;
+use Drupal\Component\Render\PlainTextOutput;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophet;
/**
- * @coversDefaultClass \Drupal\Component\Render\PlainTextOutput
- * @group Utility
+ * Tests Drupal\Component\Render\PlainTextOutput.
*/
+#[CoversClass(PlainTextOutput::class)]
+#[Group('Utility')]
class PlainTextOutputTest extends TestCase {
/**
@@ -27,9 +31,9 @@ class PlainTextOutputTest extends TestCase {
* (optional) An associative array of replacements to make. Defaults to
* none.
*
- * @covers ::renderFromHtml
- * @dataProvider providerRenderFromHtml
+ * @legacy-covers ::renderFromHtml
*/
+ #[DataProvider('providerRenderFromHtml')]
public function testRenderFromHtml($expected, $string, $args = []): void {
$markup = new FormattableMarkup($string, $args);
$output = PlainTextOutput::renderFromHtml($markup);
diff --git a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
index 9f24283f962f..3e9169c5969b 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
@@ -5,12 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Serialization;
use Drupal\Component\Serialization\Json;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Serialization\Json
- * @group Serialization
+ * Tests Drupal\Component\Serialization\Json.
*/
+#[CoversClass(Json::class)]
+#[Group('Serialization')]
class JsonTest extends TestCase {
/**
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
index 8f124a85ba95..35f45159a77f 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
@@ -6,24 +6,27 @@ namespace Drupal\Tests\Component\Serialization;
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
use Drupal\Component\Serialization\YamlPecl;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RequiresPhpExtension;
/**
* Tests the YamlPecl serialization implementation.
- *
- * @group Drupal
- * @group Serialization
- * @coversDefaultClass \Drupal\Component\Serialization\YamlPecl
- * @requires extension yaml
*/
+#[CoversClass(YamlPecl::class)]
+#[Group('Drupal')]
+#[Group('Serialization')]
+#[RequiresPhpExtension('yaml')]
class YamlPeclTest extends YamlTestBase {
/**
* Tests encoding and decoding basic data structures.
*
- * @covers ::encode
- * @covers ::decode
- * @dataProvider providerEncodeDecodeTests
+ * @legacy-covers ::encode
+ * @legacy-covers ::decode
*/
+ #[DataProvider('providerEncodeDecodeTests')]
public function testEncodeDecode(array $data): void {
$this->assertEquals($data, YamlPecl::decode(YamlPecl::encode($data)));
}
@@ -41,9 +44,9 @@ class YamlPeclTest extends YamlTestBase {
/**
* Tests decoding YAML node anchors.
*
- * @covers ::decode
- * @dataProvider providerDecodeTests
+ * @legacy-covers ::decode
*/
+ #[DataProvider('providerDecodeTests')]
public function testDecode($string, $data): void {
$this->assertEquals($data, YamlPecl::decode($string));
}
@@ -51,7 +54,7 @@ class YamlPeclTest extends YamlTestBase {
/**
* Tests our encode settings.
*
- * @covers ::encode
+ * @legacy-covers ::encode
*/
public function testEncode(): void {
// cSpell:disable
@@ -71,15 +74,15 @@ foo:
* @param string|bool $expected
* The expected return value.
*
- * @covers ::applyBooleanCallbacks
- * @dataProvider providerBoolTest
+ * @legacy-covers ::applyBooleanCallbacks
*/
+ #[DataProvider('providerBoolTest')]
public function testApplyBooleanCallbacks($string, $expected): void {
$this->assertEquals($expected, YamlPecl::applyBooleanCallbacks($string, 'bool', NULL));
}
/**
- * @covers ::getFileExtension
+ * @legacy-covers ::getFileExtension
*/
public function testGetFileExtension(): void {
$this->assertEquals('yml', YamlPecl::getFileExtension());
@@ -88,7 +91,7 @@ foo:
/**
* Tests that invalid YAML throws an exception.
*
- * @covers ::errorHandler
+ * @legacy-covers ::errorHandler
*/
public function testError(): void {
$this->expectException(InvalidDataTypeException::class);
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
index 7980f5845357..ef7e51a5101f 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php
@@ -6,23 +6,25 @@ namespace Drupal\Tests\Component\Serialization;
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
use Drupal\Component\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the Yaml serialization implementation.
- *
- * @group Drupal
- * @group Serialization
- * @coversDefaultClass \Drupal\Component\Serialization\Yaml
*/
+#[CoversClass(Yaml::class)]
+#[Group('Drupal')]
+#[Group('Serialization')]
class YamlTest extends YamlTestBase {
/**
* Tests encoding and decoding basic data structures.
*
- * @covers ::encode
- * @covers ::decode
- * @dataProvider providerEncodeDecodeTests
+ * @legacy-covers ::encode
+ * @legacy-covers ::decode
*/
+ #[DataProvider('providerEncodeDecodeTests')]
public function testEncodeDecode(array $data): void {
$this->assertSame($data, Yaml::decode(Yaml::encode($data)));
}
@@ -30,9 +32,9 @@ class YamlTest extends YamlTestBase {
/**
* Tests decoding YAML node anchors.
*
- * @covers ::decode
- * @dataProvider providerDecodeTests
+ * @legacy-covers ::decode
*/
+ #[DataProvider('providerDecodeTests')]
public function testDecode($string, $data): void {
$this->assertSame($data, Yaml::decode($string));
}
@@ -40,7 +42,7 @@ class YamlTest extends YamlTestBase {
/**
* Tests our encode settings.
*
- * @covers ::encode
+ * @legacy-covers ::encode
*/
public function testEncode(): void {
// cSpell:disable
@@ -51,7 +53,7 @@ class YamlTest extends YamlTestBase {
}
/**
- * @covers ::getFileExtension
+ * @legacy-covers ::getFileExtension
*/
public function testGetFileExtension(): void {
$this->assertSame('yml', Yaml::getFileExtension());
@@ -60,7 +62,7 @@ class YamlTest extends YamlTestBase {
/**
* Tests that invalid YAML throws an exception.
*
- * @covers ::decode
+ * @legacy-covers ::decode
*/
public function testError(): void {
$this->expectException(InvalidDataTypeException::class);
@@ -70,7 +72,7 @@ class YamlTest extends YamlTestBase {
/**
* Ensures that php object support is disabled.
*
- * @covers ::encode
+ * @legacy-covers ::encode
*/
public function testEncodeObjectSupportDisabled(): void {
$this->expectException(InvalidDataTypeException::class);
@@ -83,7 +85,7 @@ class YamlTest extends YamlTestBase {
/**
* Ensures that decoding PHP objects does not work in Symfony.
*
- * @covers ::decode
+ * @legacy-covers ::decode
*/
public function testDecodeObjectSupportDisabled(): void {
$this->expectException(InvalidDataTypeException::class);
diff --git a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
index 3badd32fab84..aa26390ae785 100644
--- a/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
+++ b/core/tests/Drupal/Tests/Component/Transliteration/PhpTransliterationTest.php
@@ -7,15 +7,16 @@ namespace Drupal\Tests\Component\Transliteration;
use Drupal\Component\Transliteration\PhpTransliteration;
use Drupal\Component\Utility\Random;
use org\bovigo\vfs\vfsStream;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests Transliteration component functionality.
- *
- * @group Transliteration
- *
- * @coversDefaultClass \Drupal\Component\Transliteration\PhpTransliteration
*/
+#[CoversClass(PhpTransliteration::class)]
+#[Group('Transliteration')]
class PhpTransliterationTest extends TestCase {
/**
@@ -25,9 +26,8 @@ class PhpTransliterationTest extends TestCase {
* The language code to test.
* @param string $expected
* The expected return from PhpTransliteration::removeDiacritics().
- *
- * @dataProvider providerTestPhpTransliterationRemoveDiacritics
*/
+ #[DataProvider('providerTestPhpTransliterationRemoveDiacritics')]
public function testRemoveDiacritics($original, $expected): void {
$transliterator_class = new PhpTransliteration();
$result = $transliterator_class->removeDiacritics($original);
@@ -88,9 +88,8 @@ class PhpTransliterationTest extends TestCase {
* (optional) If provided, return at most this many characters, ensuring
* that the transliteration does not split in the middle of an input
* character's transliteration.
- *
- * @dataProvider providerTestPhpTransliteration
*/
+ #[DataProvider('providerTestPhpTransliteration')]
public function testPhpTransliteration(string $langcode, string $original, string $expected, string $unknown_character = '?', ?int $max_length = NULL): void {
$transliterator_class = new PhpTransliteration();
$actual = $transliterator_class->transliterate($original, $langcode, $unknown_character, $max_length);
@@ -223,7 +222,7 @@ class PhpTransliterationTest extends TestCase {
/**
* Tests inclusion is safe.
*
- * @covers ::readLanguageOverrides
+ * @legacy-covers ::readLanguageOverrides
*/
public function testSafeInclude(): void {
// The overrides in the transliteration data directory transliterates 0x82
diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
index d6fadcc9fbeb..438c7e70ae72 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
@@ -5,19 +5,22 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\ArgumentsResolver;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\ArgumentsResolver
- * @group Access
+ * Tests Drupal\Component\Utility\ArgumentsResolver.
*/
+#[CoversClass(ArgumentsResolver::class)]
+#[Group('Access')]
class ArgumentsResolverTest extends TestCase {
/**
* Tests the getArgument() method.
- *
- * @dataProvider providerTestGetArgument
*/
+ #[DataProvider('providerTestGetArgument')]
public function testGetArgument($callable, $scalars, $objects, $wildcards, $expected): void {
$arguments = (new ArgumentsResolver($scalars, $objects, $wildcards))->getArguments($callable);
$this->assertSame($expected, $arguments);
@@ -164,9 +167,8 @@ class ArgumentsResolverTest extends TestCase {
/**
* Tests handleUnresolvedArgument() for missing arguments.
- *
- * @dataProvider providerTestHandleUnresolvedArgument
*/
+ #[DataProvider('providerTestHandleUnresolvedArgument')]
public function testHandleUnresolvedArgument($callable): void {
$resolver = new ArgumentsResolver([], [], []);
$this->expectException(\RuntimeException::class);
diff --git a/core/tests/Drupal/Tests/Component/Utility/BytesTest.php b/core/tests/Drupal/Tests/Component/Utility/BytesTest.php
index 04c77eb0a71b..3a7d57caa16e 100644
--- a/core/tests/Drupal/Tests/Component/Utility/BytesTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/BytesTest.php
@@ -6,6 +6,9 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Bytes;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
@@ -13,11 +16,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Tests bytes size parsing helper methods.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Bytes
*/
+#[CoversClass(Bytes::class)]
+#[Group('Utility')]
class BytesTest extends TestCase {
use ExpectDeprecationTrait;
@@ -33,9 +34,9 @@ class BytesTest extends TestCase {
* The expected return value from
* \Drupal\Component\Utility\Bytes::toNumber().
*
- * @dataProvider providerTestToNumber
- * @covers ::toNumber
+ * @legacy-covers ::toNumber
*/
+ #[DataProvider('providerTestToNumber')]
public function testToNumber($size, float $expected_number): void {
$this->assertSame($expected_number, Bytes::toNumber($size));
}
@@ -87,10 +88,10 @@ class BytesTest extends TestCase {
* The expected return value from
* \Drupal\Component\Utility\Bytes::validate().
*
- * @dataProvider providerTestValidate
- * @covers ::validate
- * @covers ::validateConstraint
+ * @legacy-covers ::validate
+ * @legacy-covers ::validateConstraint
*/
+ #[DataProvider('providerTestValidate')]
public function testValidate($string, bool $expected_result): void {
$this->assertSame($expected_result, Bytes::validate($string));
diff --git a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
index d78db87c02d1..3fc7ae24fdb3 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ColorTest.php
@@ -5,25 +5,25 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Color;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests Color utility class conversions.
- *
- * @group Utility
*/
+#[Group('Utility')]
class ColorTest extends TestCase {
/**
- * @covers \Drupal\Component\Utility\Color::validateHex
*
* @param bool $expected
* The expected result of validation.
* @param string $value
* The hex color value.
- *
- * @dataProvider providerTestValidateHex
+ * @legacy-covers \Drupal\Component\Utility\Color::validateHex
*/
+ #[DataProvider('providerTestValidateHex')]
public function testValidateHex($expected, $value): void {
$this->assertSame($expected, Color::validateHex($value));
}
@@ -77,9 +77,8 @@ class ColorTest extends TestCase {
* The expected rgb color value.
* @param bool $invalid
* Whether this value is invalid and exception should be expected.
- *
- * @dataProvider providerTestHexToRgb
*/
+ #[DataProvider('providerTestHexToRgb')]
public function testHexToRgb($value, $expected, $invalid = FALSE): void {
if ($invalid) {
$this->expectException('InvalidArgumentException');
@@ -138,9 +137,8 @@ class ColorTest extends TestCase {
* The rgb color value.
* @param string $expected
* The expected hex color value.
- *
- * @dataProvider providerTestRbgToHex
*/
+ #[DataProvider('providerTestRbgToHex')]
public function testRgbToHex($value, $expected): void {
$this->assertSame($expected, Color::rgbToHex($value));
}
@@ -205,9 +203,8 @@ class ColorTest extends TestCase {
* The input hex color value.
* @param string $expected
* The expected normalized hex color value.
- *
- * @dataProvider providerTestNormalizeHexLength
*/
+ #[DataProvider('providerTestNormalizeHexLength')]
public function testNormalizeHexLength($value, $expected): void {
$this->assertSame($expected, Color::normalizeHexLength($value));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
index 7aff98aab423..b19f815f67ab 100644
--- a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
@@ -5,15 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Crypt;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests random byte generation.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Crypt
*/
+#[CoversClass(Crypt::class)]
+#[Group('Utility')]
class CryptTest extends TestCase {
/**
@@ -24,9 +25,9 @@ class CryptTest extends TestCase {
* @param string $expected_hash
* Expected result from hashing $data.
*
- * @dataProvider providerTestHashBase64
- * @covers ::hashBase64
+ * @legacy-covers ::hashBase64
*/
+ #[DataProvider('providerTestHashBase64')]
public function testHashBase64($data, $expected_hash): void {
$hash = Crypt::hashBase64($data);
$this->assertEquals($expected_hash, $hash, 'The correct hash was not calculated.');
@@ -42,9 +43,9 @@ class CryptTest extends TestCase {
* @param string $expected_hmac
* Expected result from hashing $data using $key.
*
- * @dataProvider providerTestHmacBase64
- * @covers ::hmacBase64
+ * @legacy-covers ::hmacBase64
*/
+ #[DataProvider('providerTestHmacBase64')]
public function testHmacBase64($data, $key, $expected_hmac): void {
$hmac = Crypt::hmacBase64($data, $key);
$this->assertEquals($expected_hmac, $hmac, 'The correct hmac was not calculated.');
@@ -58,9 +59,9 @@ class CryptTest extends TestCase {
* @param string $key
* Key to use in hashing process.
*
- * @dataProvider providerTestHmacBase64Invalid
- * @covers ::hmacBase64
+ * @legacy-covers ::hmacBase64
*/
+ #[DataProvider('providerTestHmacBase64Invalid')]
public function testHmacBase64Invalid($data, $key): void {
$this->expectException('InvalidArgumentException');
Crypt::hmacBase64($data, $key);
diff --git a/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php
index 2383752bffd6..b720bad1f6d2 100644
--- a/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/DeprecationHelperTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\DeprecationHelper;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\DeprecationHelper
- * @group Utility
+ * Tests Drupal\Component\Utility\DeprecationHelper.
*/
+#[CoversClass(DeprecationHelper::class)]
+#[Group('Utility')]
class DeprecationHelperTest extends TestCase {
/**
@@ -18,9 +22,8 @@ class DeprecationHelperTest extends TestCase {
* The core version to test against.
* @param array $tests
* Array of versions and their expected result.
- *
- * @dataProvider deprecatedHelperTestCases
*/
+ #[DataProvider('deprecatedHelperTestCases')]
public function testDeprecationHelper(string $currentVersion, array $tests): void {
foreach ($tests as $deprecatedVersion => $expectedCallable) {
$result = DeprecationHelper::backwardsCompatibleCall(
diff --git a/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php b/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php
index b57f51c8b6a1..e353785fd7d4 100644
--- a/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php
@@ -6,18 +6,19 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\EmailValidator;
use Egulias\EmailValidator\Validation\RFCValidation;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the EmailValidator utility class.
- *
- * @coversDefaultClass \Drupal\Component\Utility\EmailValidator
- * @group Utility
*/
+#[CoversClass(EmailValidator::class)]
+#[Group('Utility')]
class EmailValidatorTest extends TestCase {
/**
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
public function testIsValid(): void {
// Note that \Drupal\Component\Utility\EmailValidator wraps
@@ -31,7 +32,7 @@ class EmailValidatorTest extends TestCase {
}
/**
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
public function testIsValidException(): void {
$validator = new EmailValidator();
diff --git a/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php b/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php
index 6a70b028d34e..fa8cf4912958 100644
--- a/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php
@@ -5,15 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Environment;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Test PHP Environment helper methods.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Environment
*/
+#[CoversClass(Environment::class)]
+#[Group('Utility')]
class EnvironmentTest extends TestCase {
/**
@@ -29,9 +30,9 @@ class EnvironmentTest extends TestCase {
* The expected return value from
* \Drupal\Component\Utility\Environment::checkMemoryLimit().
*
- * @dataProvider providerTestCheckMemoryLimit
- * @covers ::checkMemoryLimit
+ * @legacy-covers ::checkMemoryLimit
*/
+ #[DataProvider('providerTestCheckMemoryLimit')]
public function testCheckMemoryLimit($required, $custom_memory_limit, $expected): void {
$actual = Environment::checkMemoryLimit($required, $custom_memory_limit);
$this->assertEquals($expected, $actual);
diff --git a/core/tests/Drupal/Tests/Component/Utility/FilterArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/FilterArrayTest.php
index 289b19bfe824..e766d8ecf61c 100644
--- a/core/tests/Drupal/Tests/Component/Utility/FilterArrayTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/FilterArrayTest.php
@@ -5,23 +5,24 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\FilterArray;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Test filter array functions.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\FilterArray
*/
+#[CoversClass(FilterArray::class)]
+#[Group('Utility')]
class FilterArrayTest extends TestCase {
/**
* Tests removing empty strings.
*
- * @dataProvider providerRemoveEmptyStrings
- * @covers ::removeEmptyStrings
+ * @legacy-covers ::removeEmptyStrings
*/
+ #[DataProvider('providerRemoveEmptyStrings')]
public function testRemoveEmptyStrings(array $values, array $expected): void {
$this->assertEquals($expected, array_values(FilterArray::removeEmptyStrings($values)));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
index 800483fab501..a01684d768d3 100644
--- a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
@@ -8,17 +8,17 @@ use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Render\MarkupTrait;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Random;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
// cspell:ignore répét répété
-
/**
* Tests \Drupal\Component\Utility\Html.
- *
- * @group Common
- *
- * @coversDefaultClass \Drupal\Component\Utility\Html
*/
+#[CoversClass(Html::class)]
+#[Group('Common')]
class HtmlTest extends TestCase {
/**
@@ -42,10 +42,9 @@ class HtmlTest extends TestCase {
* (optional) An array of string replacements to use on the identifier. If
* NULL, no filter will be passed and a default will be used.
*
- * @dataProvider providerTestCleanCssIdentifier
- *
- * @covers ::cleanCssIdentifier
+ * @legacy-covers ::cleanCssIdentifier
*/
+ #[DataProvider('providerTestCleanCssIdentifier')]
public function testCleanCssIdentifier($expected, $source, $filter = NULL): void {
if ($filter !== NULL) {
$this->assertSame($expected, Html::cleanCssIdentifier($source, $filter));
@@ -94,7 +93,7 @@ class HtmlTest extends TestCase {
/**
* Tests that Html::getClass() cleans the class name properly.
*
- * @covers ::getClass
+ * @legacy-covers ::getClass
*/
public function testHtmlClass(): void {
// Verify Drupal coding standards are enforced.
@@ -116,10 +115,9 @@ class HtmlTest extends TestCase {
* @param bool $reset
* (optional) If TRUE, reset the list of seen IDs. Defaults to FALSE.
*
- * @dataProvider providerTestHtmlGetUniqueId
- *
- * @covers ::getUniqueId
+ * @legacy-covers ::getUniqueId
*/
+ #[DataProvider('providerTestHtmlGetUniqueId')]
public function testHtmlGetUniqueId($expected, $source, $reset = FALSE): void {
if ($reset) {
Html::resetSeenIds();
@@ -159,10 +157,9 @@ class HtmlTest extends TestCase {
* @param string $source
* The string being transformed to an ID.
*
- * @dataProvider providerTestHtmlGetUniqueIdWithAjaxIds
- *
- * @covers ::getUniqueId
+ * @legacy-covers ::getUniqueId
*/
+ #[DataProvider('providerTestHtmlGetUniqueIdWithAjaxIds')]
public function testHtmlGetUniqueIdWithAjaxIds($expected, $source): void {
Html::setIsAjax(TRUE);
$id = Html::getUniqueId($source);
@@ -203,10 +200,9 @@ class HtmlTest extends TestCase {
* @param string $source
* The string being transformed to an ID.
*
- * @dataProvider providerTestHtmlGetId
- *
- * @covers ::getId
+ * @legacy-covers ::getId
*/
+ #[DataProvider('providerTestHtmlGetId')]
public function testHtmlGetId($expected, $source): void {
Html::setIsAjax(FALSE);
$this->assertSame($expected, Html::getId($source));
@@ -238,9 +234,9 @@ class HtmlTest extends TestCase {
/**
* Tests Html::decodeEntities().
*
- * @dataProvider providerDecodeEntities
- * @covers ::decodeEntities
+ * @legacy-covers ::decodeEntities
*/
+ #[DataProvider('providerDecodeEntities')]
public function testDecodeEntities($text, $expected): void {
$this->assertEquals($expected, Html::decodeEntities($text));
}
@@ -279,9 +275,9 @@ class HtmlTest extends TestCase {
/**
* Tests Html::escape().
*
- * @dataProvider providerEscape
- * @covers ::escape
+ * @legacy-covers ::escape
*/
+ #[DataProvider('providerEscape')]
public function testEscape($expected, $text): void {
$this->assertEquals($expected, Html::escape($text));
}
@@ -313,8 +309,8 @@ class HtmlTest extends TestCase {
/**
* Tests relationship between escaping and decoding HTML entities.
*
- * @covers ::decodeEntities
- * @covers ::escape
+ * @legacy-covers ::decodeEntities
+ * @legacy-covers ::escape
*/
public function testDecodeEntitiesAndEscape(): void {
$string = "<em>répét&eacute;</em>";
@@ -335,7 +331,7 @@ class HtmlTest extends TestCase {
* serialization would cause errors in getElementsByTagName() in the
* serialization function.
*
- * @covers ::serialize
+ * @legacy-covers ::serialize
*/
public function testSerialize(): void {
$document = new \DOMDocument();
@@ -344,17 +340,17 @@ class HtmlTest extends TestCase {
}
/**
- * @covers ::transformRootRelativeUrlsToAbsolute
- * @dataProvider providerTestTransformRootRelativeUrlsToAbsolute
+ * @legacy-covers ::transformRootRelativeUrlsToAbsolute
*/
+ #[DataProvider('providerTestTransformRootRelativeUrlsToAbsolute')]
public function testTransformRootRelativeUrlsToAbsolute($html, $scheme_and_host, $expected_html): void {
$this->assertSame($expected_html ?: $html, Html::transformRootRelativeUrlsToAbsolute($html, $scheme_and_host));
}
/**
- * @covers ::transformRootRelativeUrlsToAbsolute
- * @dataProvider providerTestTransformRootRelativeUrlsToAbsoluteAssertion
+ * @legacy-covers ::transformRootRelativeUrlsToAbsolute
*/
+ #[DataProvider('providerTestTransformRootRelativeUrlsToAbsoluteAssertion')]
public function testTransformRootRelativeUrlsToAbsoluteAssertion($scheme_and_host): void {
$this->expectException(\AssertionError::class);
Html::transformRootRelativeUrlsToAbsolute('', $scheme_and_host);
diff --git a/core/tests/Drupal/Tests/Component/Utility/ImageTest.php b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
index e67eb9a4d163..2b0bfaab2a8e 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
@@ -5,19 +5,22 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Image;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\Image
- * @group Image
+ * Tests Drupal\Component\Utility\Image.
*/
+#[CoversClass(Image::class)]
+#[Group('Image')]
class ImageTest extends TestCase {
/**
* Tests all control flow branches in image_dimensions_scale().
- *
- * @dataProvider providerTestScaleDimensions
*/
+ #[DataProvider('providerTestScaleDimensions')]
public function testScaleDimensions($input, $output): void {
// Process the test dataset.
$return_value = Image::scaleDimensions($input['dimensions'], $input['width'], $input['height'], $input['upscale']);
@@ -158,7 +161,7 @@ class ImageTest extends TestCase {
}
/**
- * @covers ::getKeywordOffset
+ * @legacy-covers ::getKeywordOffset
*/
public function testInvalidGetKeywordOffset(): void {
$this->expectException(\InvalidArgumentException::class);
@@ -167,10 +170,9 @@ class ImageTest extends TestCase {
}
/**
- * @covers ::getKeywordOffset
- *
- * @dataProvider providerTestGetKeywordOffset
+ * @legacy-covers ::getKeywordOffset
*/
+ #[DataProvider('providerTestGetKeywordOffset')]
public function testGetKeywordOffset(array $input, int $expected): void {
$this->assertSame($expected, Image::getKeywordOffset($input['anchor'], $input['current'], $input['new']));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php
index 7a43bda8882d..97f42571ca17 100644
--- a/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\NestedArray;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\NestedArray
- * @group Utility
+ * Tests Drupal\Component\Utility\NestedArray.
*/
+#[CoversClass(NestedArray::class)]
+#[Group('Utility')]
class NestedArrayTest extends TestCase {
/**
@@ -45,7 +49,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests getting nested array values.
*
- * @covers ::getValue
+ * @legacy-covers ::getValue
*/
public function testGetValue(): void {
// Verify getting a value of a nested element.
@@ -75,7 +79,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests setting nested array values.
*
- * @covers ::setValue
+ * @legacy-covers ::setValue
*/
public function testSetValue(): void {
$new_value = [
@@ -96,7 +100,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests force-setting values.
*
- * @covers ::setValue
+ * @legacy-covers ::setValue
*/
public function testSetValueForce(): void {
$new_value = [
@@ -111,7 +115,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests unsetting nested array values.
*
- * @covers ::unsetValue
+ * @legacy-covers ::unsetValue
*/
public function testUnsetValue(): void {
// Verify unsetting a non-existing nested element throws no errors and the
@@ -146,8 +150,8 @@ class NestedArrayTest extends TestCase {
/**
* Tests NestedArray::mergeDeepArray().
*
- * @covers ::mergeDeep
- * @covers ::mergeDeepArray
+ * @legacy-covers ::mergeDeep
+ * @legacy-covers ::mergeDeepArray
*/
public function testMergeDeepArray(): void {
$link_options_1 = [
@@ -174,7 +178,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests that arrays with implicit keys are appended, not merged.
*
- * @covers ::mergeDeepArray
+ * @legacy-covers ::mergeDeepArray
*/
public function testMergeImplicitKeys(): void {
$a = [
@@ -195,7 +199,7 @@ class NestedArrayTest extends TestCase {
/**
* Tests that even with explicit keys, values are appended, not merged.
*
- * @covers ::mergeDeepArray
+ * @legacy-covers ::mergeDeepArray
*/
public function testMergeExplicitKeys(): void {
$a = [
@@ -231,7 +235,7 @@ class NestedArrayTest extends TestCase {
* before those in the first one, they are still appended, and the keys on
* the first array are deleted and regenerated.
*
- * @covers ::mergeDeepArray
+ * @legacy-covers ::mergeDeepArray
*/
public function testMergeOutOfSequenceKeys(): void {
$a = [
@@ -261,9 +265,9 @@ class NestedArrayTest extends TestCase {
}
/**
- * @covers ::filter
- * @dataProvider providerTestFilter
+ * @legacy-covers ::filter
*/
+ #[DataProvider('providerTestFilter')]
public function testFilter($array, $callable, $expected): void {
$this->assertEquals($expected, NestedArray::filter($array, $callable));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
index 2055eecde647..fdac9baf7965 100644
--- a/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/NumberTest.php
@@ -6,17 +6,19 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Number;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
/**
* Tests number manipulation utilities.
*
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Number
- *
* @see \Drupal\Component\Utility\Number
*/
+#[CoversClass(Number::class)]
+#[Group('Utility')]
class NumberTest extends TestCase {
use ExpectDeprecationTrait;
@@ -31,9 +33,9 @@ class NumberTest extends TestCase {
* @param bool $expected
* Expected return value from Number::validStep().
*
- * @dataProvider providerTestValidStep
- * @covers ::validStep
+ * @legacy-covers ::validStep
*/
+ #[DataProvider('providerTestValidStep')]
public function testValidStep($value, $step, $expected): void {
$return = Number::validStep($value, $step);
$this->assertEquals($expected, $return);
@@ -51,9 +53,9 @@ class NumberTest extends TestCase {
* @param bool $expected
* Expected return value from Number::validStep().
*
- * @dataProvider providerTestValidStepOffset
- * @covers ::validStep
+ * @legacy-covers ::validStep
*/
+ #[DataProvider('providerTestValidStepOffset')]
public function testValidStepOffset($value, $step, $offset, $expected): void {
$return = Number::validStep($value, $step, $offset);
$this->assertEquals($expected, $return);
@@ -129,10 +131,10 @@ class NumberTest extends TestCase {
* @param string $expected
* The expected alphadecimal value.
*
- * @dataProvider providerTestConversions
- * @covers ::intToAlphadecimal
- * @covers ::alphadecimalToInt
+ * @legacy-covers ::intToAlphadecimal
+ * @legacy-covers ::alphadecimalToInt
*/
+ #[DataProvider('providerTestConversions')]
public function testConversions($value, $expected): void {
$this->assertSame(Number::intToAlphadecimal($value), $expected);
$this->assertSame($value, Number::alphadecimalToInt($expected));
@@ -166,7 +168,7 @@ class NumberTest extends TestCase {
* Number::alphadecimalToInt() must throw an exception
* when non-alphanumeric characters are passed as input.
*
- * @covers ::alphadecimalToInt
+ * @legacy-covers ::alphadecimalToInt
*/
public function testAlphadecimalToIntThrowsExceptionWithMalformedStrings(): void {
$this->expectException(\InvalidArgumentException::class);
@@ -180,9 +182,9 @@ class NumberTest extends TestCase {
* Many tests and code rely on Number::alphadecimalToInt() returning 0
* for degenerate values '' and NULL. We must ensure they are accepted.
*
- * @group legacy
- * @covers ::alphadecimalToInt
+ * @legacy-covers ::alphadecimalToInt
*/
+ #[IgnoreDeprecations]
public function testAlphadecimalToIntReturnsZeroWithNullAndEmptyString(): void {
$deprecationMessage = 'Passing NULL or an empty string to Drupal\Component\Utility\Number::alphadecimalToInt() is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. See https://www.drupal.org/node/3494472';
$this->expectDeprecation($deprecationMessage);
diff --git a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
index 64de3b2061a4..f46b0cd9b557 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
@@ -5,15 +5,15 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Random;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests random data generation.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Random
*/
+#[CoversClass(Random::class)]
+#[Group('Utility')]
class RandomTest extends TestCase {
/**
@@ -28,7 +28,7 @@ class RandomTest extends TestCase {
/**
* Tests unique random string generation.
*
- * @covers ::string
+ * @legacy-covers ::string
*/
public function testRandomStringUniqueness(): void {
$strings = [];
@@ -43,7 +43,7 @@ class RandomTest extends TestCase {
/**
* Tests unique random name generation.
*
- * @covers ::name
+ * @legacy-covers ::name
*/
public function testRandomNamesUniqueness(): void {
$names = [];
@@ -58,7 +58,7 @@ class RandomTest extends TestCase {
/**
* Tests infinite loop prevention whilst generating random names.
*
- * @covers ::name
+ * @legacy-covers ::name
*/
public function testRandomNameException(): void {
// There are fewer than 100 possibilities so an exception should occur to
@@ -74,7 +74,7 @@ class RandomTest extends TestCase {
/**
* Tests infinite loop prevention whilst generating random strings.
*
- * @covers ::string
+ * @legacy-covers ::string
*/
public function testRandomStringException(): void {
// There are fewer than 100 possibilities so an exception should occur to
@@ -90,7 +90,7 @@ class RandomTest extends TestCase {
/**
* Tests random name generation if uniqueness is not enforced.
*
- * @covers ::name
+ * @legacy-covers ::name
*/
public function testRandomNameNonUnique(): void {
// There are fewer than 100 possibilities if we were forcing uniqueness so
@@ -105,7 +105,7 @@ class RandomTest extends TestCase {
/**
* Tests random string if uniqueness is not enforced.
*
- * @covers ::string
+ * @legacy-covers ::string
*/
public function testRandomStringNonUnique(): void {
// There are fewer than 100 possibilities if we were forcing uniqueness so
@@ -120,7 +120,7 @@ class RandomTest extends TestCase {
/**
* Tests unique random name generation.
*
- * @covers ::machineName
+ * @legacy-covers ::machineName
*/
public function testRandomMachineNamesUniqueness(): void {
$names = [];
@@ -135,7 +135,7 @@ class RandomTest extends TestCase {
/**
* Tests infinite loop prevention whilst generating random names.
*
- * @covers ::machineName
+ * @legacy-covers ::machineName
*/
public function testRandomMachineNameException(): void {
// There are fewer than 100 possibilities so an exception should occur to
@@ -150,7 +150,7 @@ class RandomTest extends TestCase {
/**
* Tests random name generation if uniqueness is not enforced.
*
- * @covers ::machineName
+ * @legacy-covers ::machineName
*/
public function testRandomMachineNameNonUnique(): void {
// There are fewer than 100 possibilities meaning if uniqueness was
@@ -165,7 +165,7 @@ class RandomTest extends TestCase {
/**
* Tests random object generation to ensure the expected number of properties.
*
- * @covers ::object
+ * @legacy-covers ::object
*/
public function testRandomObject(): void {
// For values of 0 and 1 \Drupal\Component\Utility\Random::object() will
@@ -180,7 +180,7 @@ class RandomTest extends TestCase {
/**
* Tests random string validation callbacks.
*
- * @covers ::string
+ * @legacy-covers ::string
*/
public function testRandomStringValidator(): void {
$random = new Random();
@@ -192,7 +192,7 @@ class RandomTest extends TestCase {
/**
* Tests random word.
*
- * @covers ::word
+ * @legacy-covers ::word
*/
public function testRandomWordValidator(): void {
$random = new Random();
diff --git a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
index 5635173a6de6..45942f226fa3 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
@@ -5,18 +5,22 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Rectangle;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\Rectangle
- * @group Image
+ * Tests Drupal\Component\Utility\Rectangle.
*/
+#[CoversClass(Rectangle::class)]
+#[Group('Image')]
class RectangleTest extends TestCase {
/**
* Tests wrong rectangle width.
*
- * @covers ::rotate
+ * @legacy-covers ::rotate
*/
public function testWrongWidth(): void {
$this->expectException(\InvalidArgumentException::class);
@@ -26,7 +30,7 @@ class RectangleTest extends TestCase {
/**
* Tests wrong rectangle height.
*
- * @covers ::rotate
+ * @legacy-covers ::rotate
*/
public function testWrongHeight(): void {
$this->expectException(\InvalidArgumentException::class);
@@ -47,12 +51,11 @@ class RectangleTest extends TestCase {
* @param int $exp_height
* The expected height of the rotated rectangle.
*
- * @covers ::rotate
- * @covers ::getBoundingWidth
- * @covers ::getBoundingHeight
- *
- * @dataProvider providerPhp55RotateDimensions
+ * @legacy-covers ::rotate
+ * @legacy-covers ::getBoundingWidth
+ * @legacy-covers ::getBoundingHeight
*/
+ #[DataProvider('providerPhp55RotateDimensions')]
public function testRotateDimensions($width, $height, $angle, $exp_width, $exp_height): void {
$rect = new Rectangle($width, $height);
$rect->rotate($angle);
diff --git a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php
index 4a0a6fb4b854..f498157f08b8 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ReflectionTest.php
@@ -5,12 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Reflection;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Utility\Reflection
- * @group Utility
+ * Tests Drupal\Component\Utility\Reflection.
*/
+#[CoversClass(Reflection::class)]
+#[Group('Utility')]
class ReflectionTest extends TestCase {
/**
@@ -19,9 +23,9 @@ class ReflectionTest extends TestCase {
* @param \ReflectionParameter $parameter
* The reflection parameter.
*
- * @covers ::getParameterClassName
- * @dataProvider providerGetParameterClassName
+ * @legacy-covers ::getParameterClassName
*/
+ #[DataProvider('providerGetParameterClassName')]
public function testGetParameterClassName(?string $expected, \ReflectionParameter $parameter): void {
$this->assertEquals($expected, Reflection::getParameterClassName($parameter));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
index 9cc47d17d965..37a431411b34 100644
--- a/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/SortArrayTest.php
@@ -5,15 +5,16 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\SortArray;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the SortArray component.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\SortArray
*/
+#[CoversClass(SortArray::class)]
+#[Group('Utility')]
class SortArrayTest extends TestCase {
/**
@@ -26,11 +27,10 @@ class SortArrayTest extends TestCase {
* @param int $expected
* The expected output from calling the method.
*
- * @covers ::sortByWeightElement
- * @covers ::sortByKeyInt
- *
- * @dataProvider providerSortByWeightElement
+ * @legacy-covers ::sortByWeightElement
+ * @legacy-covers ::sortByKeyInt
*/
+ #[DataProvider('providerSortByWeightElement')]
public function testSortByWeightElement($a, $b, $expected): void {
$result = SortArray::sortByWeightElement($a, $b);
$this->assertBothNegativePositiveOrZero($expected, $result);
@@ -103,10 +103,10 @@ class SortArrayTest extends TestCase {
* @param int $expected
* The expected output from calling the method.
*
- * @dataProvider providerSortByWeightProperty
- * @covers ::sortByWeightProperty
- * @covers ::sortByKeyInt
+ * @legacy-covers ::sortByWeightProperty
+ * @legacy-covers ::sortByKeyInt
*/
+ #[DataProvider('providerSortByWeightProperty')]
public function testSortByWeightProperty($a, $b, $expected): void {
$result = SortArray::sortByWeightProperty($a, $b);
$this->assertBothNegativePositiveOrZero($expected, $result);
@@ -179,10 +179,10 @@ class SortArrayTest extends TestCase {
* @param int $expected
* The expected output from calling the method.
*
- * @dataProvider providerSortByTitleElement
- * @covers ::sortByTitleElement
- * @covers ::sortByKeyString
+ * @legacy-covers ::sortByTitleElement
+ * @legacy-covers ::sortByKeyString
*/
+ #[DataProvider('providerSortByTitleElement')]
public function testSortByTitleElement($a, $b, $expected): void {
$result = SortArray::sortByTitleElement($a, $b);
$this->assertBothNegativePositiveOrZero($expected, $result);
@@ -248,10 +248,10 @@ class SortArrayTest extends TestCase {
* @param int $expected
* The expected output from calling the method.
*
- * @dataProvider providerSortByTitleProperty
- * @covers ::sortByTitleProperty
- * @covers ::sortByKeyString
+ * @legacy-covers ::sortByTitleProperty
+ * @legacy-covers ::sortByKeyString
*/
+ #[DataProvider('providerSortByTitleProperty')]
public function testSortByTitleProperty($a, $b, $expected): void {
$result = SortArray::sortByTitleProperty($a, $b);
$this->assertBothNegativePositiveOrZero($expected, $result);
diff --git a/core/tests/Drupal/Tests/Component/Utility/TimerTest.php b/core/tests/Drupal/Tests/Component/Utility/TimerTest.php
index 470ff1de13fe..12996f564f4b 100644
--- a/core/tests/Drupal/Tests/Component/Utility/TimerTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/TimerTest.php
@@ -5,23 +5,23 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Timer;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the Timer system.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Timer
*/
+#[CoversClass(Timer::class)]
+#[Group('Utility')]
class TimerTest extends TestCase {
/**
* Tests Timer::read() time accumulation accuracy across multiple restarts.
*
- * @covers ::start
- * @covers ::stop
- * @covers ::read
+ * @legacy-covers ::start
+ * @legacy-covers ::stop
+ * @legacy-covers ::read
*/
public function testTimer(): void {
Timer::start('test');
diff --git a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
index c0dbfa92d757..06e6e1ef7d4c 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php
@@ -6,24 +6,25 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Unicode;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Test unicode handling features implemented in Unicode component.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Unicode
*/
+#[CoversClass(Unicode::class)]
+#[Group('Utility')]
class UnicodeTest extends TestCase {
use ExpectDeprecationTrait;
/**
* Tests multibyte ucfirst.
*
- * @dataProvider providerUcfirst
- * @covers ::ucfirst
+ * @legacy-covers ::ucfirst
*/
+ #[DataProvider('providerUcfirst')]
public function testUcfirst($text, $expected): void {
$this->assertEquals($expected, Unicode::ucfirst($text));
}
@@ -52,9 +53,9 @@ class UnicodeTest extends TestCase {
/**
* Tests multibyte lcfirst.
*
- * @dataProvider providerLcfirst
- * @covers ::lcfirst
+ * @legacy-covers ::lcfirst
*/
+ #[DataProvider('providerLcfirst')]
public function testLcfirst($text, $expected): void {
$this->assertEquals($expected, Unicode::lcfirst($text));
}
@@ -83,9 +84,9 @@ class UnicodeTest extends TestCase {
/**
* Tests multibyte ucwords.
*
- * @dataProvider providerUcwords
- * @covers ::ucwords
+ * @legacy-covers ::ucwords
*/
+ #[DataProvider('providerUcwords')]
public function testUcwords($text, $expected): void {
$this->assertEquals($expected, Unicode::ucwords($text));
}
@@ -116,9 +117,9 @@ class UnicodeTest extends TestCase {
/**
* Tests multibyte truncate.
*
- * @dataProvider providerTruncate
- * @covers ::truncate
+ * @legacy-covers ::truncate
*/
+ #[DataProvider('providerTruncate')]
public function testTruncate($text, $max_length, $expected, $wordsafe = FALSE, $add_ellipsis = FALSE): void {
$this->assertEquals($expected, Unicode::truncate($text, $max_length, $wordsafe, $add_ellipsis));
}
@@ -215,9 +216,9 @@ EOF;
* @param string $expected
* The expected return from Unicode::truncateBytes().
*
- * @dataProvider providerTestTruncateBytes
- * @covers ::truncateBytes
+ * @legacy-covers ::truncateBytes
*/
+ #[DataProvider('providerTestTruncateBytes')]
public function testTruncateBytes($text, $max_length, $expected): void {
$this->assertEquals($expected, Unicode::truncateBytes($text, $max_length), 'The string was not correctly truncated.');
}
@@ -250,9 +251,9 @@ EOF;
* @param string $message
* The message to display on failure.
*
- * @dataProvider providerTestValidateUtf8
- * @covers ::validateUtf8
+ * @legacy-covers ::validateUtf8
*/
+ #[DataProvider('providerTestValidateUtf8')]
public function testValidateUtf8($text, $expected, $message): void {
$this->assertEquals($expected, Unicode::validateUtf8($text), $message);
}
@@ -290,9 +291,9 @@ EOF;
* @param string|bool $expected
* The expected result.
*
- * @dataProvider providerTestConvertToUtf8
- * @covers ::convertToUtf8
+ * @legacy-covers ::convertToUtf8
*/
+ #[DataProvider('providerTestConvertToUtf8')]
public function testConvertToUtf8($data, $encoding, $expected): void {
$this->assertEquals($expected, Unicode::convertToUtf8($data, $encoding));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
index 0d5eb029d07b..571009cf539a 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
@@ -5,13 +5,17 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\UrlHelper;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
/**
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\UrlHelper
+ * Tests Drupal\Component\Utility\UrlHelper.
*/
+#[CoversClass(UrlHelper::class)]
+#[Group('Utility')]
class UrlHelperTest extends TestCase {
/**
@@ -43,9 +47,9 @@ class UrlHelperTest extends TestCase {
* @param string $message
* The assertion message.
*
- * @dataProvider providerTestBuildQuery
- * @covers ::buildQuery
+ * @legacy-covers ::buildQuery
*/
+ #[DataProvider('providerTestBuildQuery')]
public function testBuildQuery($query, $expected, $message): void {
$this->assertEquals(UrlHelper::buildQuery($query), $expected, $message);
}
@@ -91,9 +95,9 @@ class UrlHelperTest extends TestCase {
* @param string $scheme
* The scheme to test.
*
- * @dataProvider providerTestValidAbsoluteData
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
+ #[DataProvider('providerTestValidAbsoluteData')]
public function testValidAbsolute(string $url, string $scheme): void {
$test_url = $scheme . '://' . $url;
$valid_url = UrlHelper::isValid($test_url, TRUE);
@@ -147,9 +151,9 @@ class UrlHelperTest extends TestCase {
* @param string $scheme
* The scheme to test.
*
- * @dataProvider providerTestInvalidAbsolute
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
+ #[DataProvider('providerTestInvalidAbsolute')]
public function testInvalidAbsolute(string $url, string $scheme): void {
$test_url = $scheme . '://' . $url;
$valid_url = UrlHelper::isValid($test_url, TRUE);
@@ -182,9 +186,9 @@ class UrlHelperTest extends TestCase {
* @param string $prefix
* The prefix to test.
*
- * @dataProvider providerTestValidRelativeData
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
+ #[DataProvider('providerTestValidRelativeData')]
public function testValidRelative(string $url, string $prefix): void {
$test_url = $prefix . $url;
$valid_url = UrlHelper::isValid($test_url);
@@ -215,9 +219,9 @@ class UrlHelperTest extends TestCase {
* @param string $prefix
* The prefix to test.
*
- * @dataProvider providerTestInvalidRelativeData
- * @covers ::isValid
+ * @legacy-covers ::isValid
*/
+ #[DataProvider('providerTestInvalidRelativeData')]
public function testInvalidRelative(string $url, string $prefix): void {
$test_url = $prefix . $url;
$valid_url = UrlHelper::isValid($test_url);
@@ -235,9 +239,9 @@ class UrlHelperTest extends TestCase {
* @param array $expected
* An array containing query parameters.
*
- * @dataProvider providerTestFilterQueryParameters
- * @covers ::filterQueryParameters
+ * @legacy-covers ::filterQueryParameters
*/
+ #[DataProvider('providerTestFilterQueryParameters')]
public function testFilterQueryParameters($query, $exclude, $expected): void {
$filtered = UrlHelper::filterQueryParameters($query, $exclude);
$this->assertEquals($expected, $filtered, 'The query was not properly filtered.');
@@ -274,9 +278,9 @@ class UrlHelperTest extends TestCase {
* @param array $expected
* Associative array with expected parameters.
*
- * @dataProvider providerTestParse
- * @covers ::parse
+ * @legacy-covers ::parse
*/
+ #[DataProvider('providerTestParse')]
public function testParse($url, $expected): void {
$parsed = UrlHelper::parse($url);
$this->assertEquals($expected, $parsed, 'The URL was not properly parsed.');
@@ -405,9 +409,9 @@ class UrlHelperTest extends TestCase {
* @param string $expected
* The expected encoded path.
*
- * @dataProvider providerTestEncodePath
- * @covers ::encodePath
+ * @legacy-covers ::encodePath
*/
+ #[DataProvider('providerTestEncodePath')]
public function testEncodePath($path, $expected): void {
$encoded = UrlHelper::encodePath($path);
$this->assertEquals($expected, $encoded);
@@ -434,9 +438,9 @@ class UrlHelperTest extends TestCase {
* @param bool $expected
* Expected result.
*
- * @dataProvider providerTestIsExternal
- * @covers ::isExternal
+ * @legacy-covers ::isExternal
*/
+ #[DataProvider('providerTestIsExternal')]
public function testIsExternal($path, $expected): void {
$isExternal = UrlHelper::isExternal($path);
$this->assertEquals($expected, $isExternal);
@@ -494,11 +498,11 @@ class UrlHelperTest extends TestCase {
* @param array $protocols
* Protocols to allow.
*
- * @dataProvider providerTestFilterBadProtocol
- * @covers ::setAllowedProtocols
- * @covers ::filterBadProtocol
- * @runInSeparateProcess
+ * @legacy-covers ::setAllowedProtocols
+ * @legacy-covers ::filterBadProtocol
*/
+ #[DataProvider('providerTestFilterBadProtocol')]
+ #[RunInSeparateProcess]
public function testFilterBadProtocol($uri, $expected, $protocols): void {
UrlHelper::setAllowedProtocols($protocols);
$this->assertEquals($expected, UrlHelper::filterBadProtocol($uri));
@@ -535,11 +539,11 @@ class UrlHelperTest extends TestCase {
* @param array $protocols
* Protocols to allow.
*
- * @dataProvider providerTestStripDangerousProtocols
- * @covers ::setAllowedProtocols
- * @covers ::stripDangerousProtocols
- * @runInSeparateProcess
+ * @legacy-covers ::setAllowedProtocols
+ * @legacy-covers ::stripDangerousProtocols
*/
+ #[DataProvider('providerTestStripDangerousProtocols')]
+ #[RunInSeparateProcess]
public function testStripDangerousProtocols($uri, $expected, $protocols): void {
UrlHelper::setAllowedProtocols($protocols);
$stripped = UrlHelper::stripDangerousProtocols($uri);
@@ -615,9 +619,9 @@ class UrlHelperTest extends TestCase {
* TRUE if an external URL points to this installation as determined by the
* base URL.
*
- * @covers ::externalIsLocal
- * @dataProvider providerTestExternalIsLocal
+ * @legacy-covers ::externalIsLocal
*/
+ #[DataProvider('providerTestExternalIsLocal')]
public function testExternalIsLocal($url, $base_url, $expected): void {
$this->assertSame($expected, UrlHelper::externalIsLocal($url, $base_url));
}
@@ -667,9 +671,9 @@ class UrlHelperTest extends TestCase {
* @param string $base_url
* The base URL.
*
- * @covers ::externalIsLocal
- * @dataProvider providerTestExternalIsLocalInvalid
+ * @legacy-covers ::externalIsLocal
*/
+ #[DataProvider('providerTestExternalIsLocalInvalid')]
public function testExternalIsLocalInvalid($url, $base_url): void {
$this->expectException(\InvalidArgumentException::class);
UrlHelper::externalIsLocal($url, $base_url);
diff --git a/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php b/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php
index 601b31956968..467d65d4d36a 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php
@@ -6,17 +6,17 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Random;
use Drupal\Component\Utility\UserAgent;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
// cspell:ignore Teletubbies
-
/**
* Tests bytes size parsing helper methods.
- *
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\UserAgent
*/
+#[CoversClass(UserAgent::class)]
+#[Group('Utility')]
class UserAgentTest extends TestCase {
/**
@@ -71,9 +71,9 @@ class UserAgentTest extends TestCase {
/**
* Tests matching language from user agent.
*
- * @dataProvider providerTestGetBestMatchingLangcode
- * @covers ::getBestMatchingLangcode
+ * @legacy-covers ::getBestMatchingLangcode
*/
+ #[DataProvider('providerTestGetBestMatchingLangcode')]
public function testGetBestMatchingLangcode($accept_language, $expected): void {
$result = UserAgent::getBestMatchingLangcode($accept_language, $this->getLanguages(), $this->getMappings());
$this->assertSame($expected, $result);
diff --git a/core/tests/Drupal/Tests/Component/Utility/VariableTest.php b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php
index 172a9b038781..d00203bfe9cf 100644
--- a/core/tests/Drupal/Tests/Component/Utility/VariableTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/VariableTest.php
@@ -5,16 +5,17 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Variable;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Test variable export functionality in Variable component.
- *
- * @group Variable
- * @group Utility
- *
- * @coversDefaultClass \Drupal\Component\Utility\Variable
*/
+#[CoversClass(Variable::class)]
+#[Group('Variable')]
+#[Group('Utility')]
class VariableTest extends TestCase {
/**
@@ -75,10 +76,9 @@ class VariableTest extends TestCase {
* @param string $expected_name
* The expected human-readable name of the callable.
*
- * @dataProvider providerCallableToString
- *
- * @covers ::callableToString
+ * @legacy-covers ::callableToString
*/
+ #[DataProvider('providerCallableToString')]
public function testCallableToString($callable, string $expected_name): void {
$this->assertSame($expected_name, Variable::callableToString($callable));
}
@@ -171,9 +171,9 @@ class VariableTest extends TestCase {
* @param mixed $variable
* The variable to be exported.
*
- * @covers ::export
- * @dataProvider providerTestExport
+ * @legacy-covers ::export
*/
+ #[DataProvider('providerTestExport')]
public function testExport($expected, $variable): void {
$this->assertEquals($expected, Variable::export($variable));
}
diff --git a/core/tests/Drupal/Tests/Component/Utility/XssTest.php b/core/tests/Drupal/Tests/Component/Utility/XssTest.php
index 32f345ac0160..693a75d6f928 100644
--- a/core/tests/Drupal/Tests/Component/Utility/XssTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/XssTest.php
@@ -7,12 +7,15 @@ namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Component\Utility\Xss;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PHPUnit\Framework\TestCase;
// cspell:ignore ascript barbaz ckers cript CVEs dynsrc fooÿñ msgbox ncript
// cspell:ignore nfocus nmedi nosuchscheme nosuchtag onmediaerror scrscriptipt
// cspell:ignore tascript vbscript
-
/**
* XSS Filtering tests.
*
@@ -21,11 +24,10 @@ use PHPUnit\Framework\TestCase;
* Relevant CVEs:
* - CVE-2002-1806, ~CVE-2005-0682, ~CVE-2005-2106, CVE-2005-3973,
* CVE-2006-1226 (= rev. 1.112?), CVE-2008-0273, CVE-2008-3740.
- *
- * @group Utility
- * @coversDefaultClass \Drupal\Component\Utility\Xss
- * @runTestsInSeparateProcesses
*/
+#[CoversClass(Xss::class)]
+#[Group('Utility')]
+#[RunTestsInSeparateProcesses]
class XssTest extends TestCase {
/**
@@ -66,9 +68,8 @@ class XssTest extends TestCase {
* @param array $allowed_tags
* (optional) The allowed HTML tags to be passed to
* \Drupal\Component\Utility\Xss::filter().
- *
- * @dataProvider providerTestFilterXssNormalized
*/
+ #[DataProvider('providerTestFilterXssNormalized')]
public function testFilterXssNormalized($value, $expected, $message, ?array $allowed_tags = NULL): void {
if ($allowed_tags === NULL) {
$value = Xss::filter($value);
@@ -134,9 +135,8 @@ class XssTest extends TestCase {
* @param array $allowed_tags
* (optional) The allowed HTML tags to be passed to
* \Drupal\Component\Utility\Xss::filter().
- *
- * @dataProvider providerTestFilterXssNotNormalized
*/
+ #[DataProvider('providerTestFilterXssNotNormalized')]
public function testFilterXssNotNormalized($value, $expected, $message, ?array $allowed_tags = NULL): void {
if ($allowed_tags === NULL) {
$value = Xss::filter($value);
@@ -453,9 +453,8 @@ class XssTest extends TestCase {
* The expected result.
* @param string $message
* The assertion message to display upon failure.
- *
- * @dataProvider providerTestInvalidMultiByte
*/
+ #[DataProvider('providerTestInvalidMultiByte')]
public function testInvalidMultiByte($value, $expected, $message): void {
$this->assertEquals(Xss::filter($value), $expected, $message);
}
@@ -490,9 +489,9 @@ class XssTest extends TestCase {
/**
* Check that strings in HTML attributes are correctly processed.
*
- * @covers ::attributes
- * @dataProvider providerTestAttributes
+ * @legacy-covers ::attributes
*/
+ #[DataProvider('providerTestAttributes')]
public function testAttribute($value, $expected, $message, $allowed_tags = NULL): void {
$value = Xss::filter($value, $allowed_tags);
$this->assertEquals($expected, $value, $message);
@@ -589,9 +588,8 @@ class XssTest extends TestCase {
* The expected result.
* @param string $message
* The assertion message to display upon failure.
- *
- * @dataProvider providerTestFilterXssAdminNotNormalized
*/
+ #[DataProvider('providerTestFilterXssAdminNotNormalized')]
public function testFilterXssAdminNotNormalized($value, $expected, $message): void {
$this->assertNotNormalized(Xss::filterAdmin($value), $expected, $message);
}
diff --git a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
index 1d1f0b402322..26eeed78544d 100644
--- a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
+++ b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
@@ -4,34 +4,33 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Uuid;
-use Drupal\Component\Uuid\Uuid;
-use Drupal\Component\Uuid\UuidInterface;
use Drupal\Component\Uuid\Com;
use Drupal\Component\Uuid\Pecl;
use Drupal\Component\Uuid\Php;
+use Drupal\Component\Uuid\Uuid;
+use Drupal\Component\Uuid\UuidInterface;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
* Tests the handling of Universally Unique Identifiers (UUIDs).
- *
- * @group Uuid
*/
+#[Group('Uuid')]
class UuidTest extends TestCase {
/**
* Tests generating valid UUIDs.
- *
- * @dataProvider providerUuidInstances
*/
+ #[DataProvider('providerUuidInstances')]
public function testGenerateUuid(UuidInterface $instance): void {
$this->assertTrue(Uuid::isValid($instance->generate()), sprintf('UUID generation for %s works.', get_class($instance)));
}
/**
* Tests that generated UUIDs are unique.
- *
- * @dataProvider providerUuidInstances
*/
+ #[DataProvider('providerUuidInstances')]
public function testUuidIsUnique(UuidInterface $instance): void {
$this->assertNotEquals($instance->generate(), $instance->generate(), sprintf('Same UUID was not generated twice with %s.', get_class($instance)));
}
@@ -69,9 +68,8 @@ class UuidTest extends TestCase {
* Whether the uuid is valid or not.
* @param string $message
* The message to display on failure.
- *
- * @dataProvider providerTestValidation
*/
+ #[DataProvider('providerTestValidation')]
public function testValidation($uuid, $is_valid, $message): void {
$this->assertSame($is_valid, Uuid::isValid($uuid), $message);
}
diff --git a/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php b/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php
index 78109e573f0a..566a2d207a1e 100644
--- a/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php
+++ b/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php
@@ -5,18 +5,22 @@ declare(strict_types=1);
namespace Drupal\Tests\Component\Version;
use Drupal\Component\Version\Constraint;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
/**
- * @coversDefaultClass \Drupal\Component\Version\Constraint
- * @group Version
+ * Tests Drupal\Component\Version\Constraint.
*/
+#[CoversClass(Constraint::class)]
+#[Group('Version')]
class ConstraintTest extends TestCase {
/**
- * @covers ::isCompatible
- * @dataProvider providerIsCompatible
+ * @legacy-covers ::isCompatible
*/
+ #[DataProvider('providerIsCompatible')]
public function testIsCompatible(Constraint $version_info, string $current_version, bool $result): void {
$this->assertSame($result, $version_info->isCompatible($current_version));
}
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
index df504f4b7269..cdfb897046c6 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
@@ -6,6 +6,7 @@ namespace Drupal\Tests\Core\DependencyInjection\Compiler;
use Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass;
use Drupal\Tests\UnitTestCase;
+use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;
@@ -307,6 +308,31 @@ class TaggedHandlersPassTest extends UnitTestCase {
}
/**
+ * Tests child handler with parent service.
+ *
+ * @covers ::process
+ */
+ public function testProcessChildDefinition(): void {
+ $container = $this->buildContainer();
+
+ $container
+ ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer')
+ ->addTag('service_collector');
+ $container
+ ->register('root_handler', __NAMESPACE__ . '\ValidHandler');
+ $container->addDefinitions([
+ 'parent_handler' => new ChildDefinition('root_handler'),
+ 'child_handler' => (new ChildDefinition('parent_handler'))->addTag('consumer_id'),
+ ]);
+
+ $handler_pass = new TaggedHandlersPass();
+ $handler_pass->process($container);
+
+ $method_calls = $container->getDefinition('consumer_id')->getMethodCalls();
+ $this->assertCount(1, $method_calls);
+ }
+
+ /**
* Tests consumer method with extra parameters.
*
* @covers ::process
diff --git a/core/themes/claro/claro.theme b/core/themes/claro/claro.theme
index 81255d798a3e..e6b5cc443163 100644
--- a/core/themes/claro/claro.theme
+++ b/core/themes/claro/claro.theme
@@ -1181,7 +1181,7 @@ function claro_preprocess_table(&$variables): void {
$first_cell_key = array_key_first($row['cells']);
// The 'attributes' key is always here and it is an
// \Drupal\Core\Template\Attribute.
- // @see template_preprocess_table();
+ // @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable();
$row['cells'][$first_cell_key]['attributes']->addClass('tabledrag-cell');
// Check that the first cell is empty or not.
diff --git a/core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig b/core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
index e9928fd77660..4940f047477e 100644
--- a/core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
+++ b/core/themes/claro/templates/classy/dataset/item-list--search-results.html.twig
@@ -17,7 +17,7 @@
* results, the following data is set:
* - plugin: The search plugin ID, for example "node_search".
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{%
diff --git a/core/themes/claro/templates/classy/dataset/item-list.html.twig b/core/themes/claro/templates/classy/dataset/item-list.html.twig
index 20541b0b7e66..6e7b8e317b1d 100644
--- a/core/themes/claro/templates/classy/dataset/item-list.html.twig
+++ b/core/themes/claro/templates/classy/dataset/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if context.list_style %}
diff --git a/core/themes/claro/templates/classy/dataset/table.html.twig b/core/themes/claro/templates/classy/dataset/table.html.twig
index cdfe0bff7e73..d7e6459bd4a4 100644
--- a/core/themes/claro/templates/classy/dataset/table.html.twig
+++ b/core/themes/claro/templates/classy/dataset/table.html.twig
@@ -38,7 +38,7 @@
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
*/
#}
<table{{ attributes }}>
diff --git a/core/themes/claro/templates/classy/field/image.html.twig b/core/themes/claro/templates/classy/field/image.html.twig
index 31f782bb60a8..90d955c180a6 100644
--- a/core/themes/claro/templates/classy/field/image.html.twig
+++ b/core/themes/claro/templates/classy/field/image.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the img tag.
* - style_name: (optional) The name of the image style applied.
*
- * @see template_preprocess_image()
+ * @see \Drupal\Core\Theme\ImagePreprocess::preprocessImage()
*/
#}
{%
diff --git a/core/themes/claro/templates/classy/layout/region.html.twig b/core/themes/claro/templates/classy/layout/region.html.twig
index 95e71cec37e4..a4e8cc0af72a 100644
--- a/core/themes/claro/templates/classy/layout/region.html.twig
+++ b/core/themes/claro/templates/classy/layout/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/claro/templates/install-page.html.twig b/core/themes/claro/templates/install-page.html.twig
index bd22c5a94598..f7456333c8d1 100644
--- a/core/themes/claro/templates/install-page.html.twig
+++ b/core/themes/claro/templates/install-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_install_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessInstallPage()
*/
#}
<div class="layout-container">
diff --git a/core/themes/claro/templates/maintenance-page--front.html.twig b/core/themes/claro/templates/maintenance-page--front.html.twig
index 12a364ee6a00..daeaf2d7ca23 100644
--- a/core/themes/claro/templates/maintenance-page--front.html.twig
+++ b/core/themes/claro/templates/maintenance-page--front.html.twig
@@ -9,7 +9,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*/
#}
<div class="layout-container">
diff --git a/core/themes/claro/templates/maintenance-page.html.twig b/core/themes/claro/templates/maintenance-page.html.twig
index 9bbb9a0e0ce4..ef40bbcbec0e 100644
--- a/core/themes/claro/templates/maintenance-page.html.twig
+++ b/core/themes/claro/templates/maintenance-page.html.twig
@@ -9,7 +9,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
* @see maintenance-page--front.html.twig
*/
#}
diff --git a/core/themes/claro/templates/media-library/item-list--media-library-add-form-media-list.html.twig b/core/themes/claro/templates/media-library/item-list--media-library-add-form-media-list.html.twig
index d7931e16b1d5..302e437c8a1f 100644
--- a/core/themes/claro/templates/media-library/item-list--media-library-add-form-media-list.html.twig
+++ b/core/themes/claro/templates/media-library/item-list--media-library-add-form-media-list.html.twig
@@ -20,7 +20,7 @@
* - list_style: The custom list style.
*
* @see claro_preprocess_item_list__media_library_add_form_media_list()
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if items -%}
diff --git a/core/themes/claro/templates/navigation/menu-local-task--views-ui.html.twig b/core/themes/claro/templates/navigation/menu-local-task--views-ui.html.twig
index be73cf7bb89c..7c8a59ebd35a 100644
--- a/core/themes/claro/templates/navigation/menu-local-task--views-ui.html.twig
+++ b/core/themes/claro/templates/navigation/menu-local-task--views-ui.html.twig
@@ -11,7 +11,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*
* @todo remove this after https://www.drupal.org/node/3051605 has been solved.
*/
diff --git a/core/themes/claro/templates/navigation/menu-local-task.html.twig b/core/themes/claro/templates/navigation/menu-local-task.html.twig
index b135a5ddcf3b..b0b6ce08db94 100644
--- a/core/themes/claro/templates/navigation/menu-local-task.html.twig
+++ b/core/themes/claro/templates/navigation/menu-local-task.html.twig
@@ -12,7 +12,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*/
#}
{%
diff --git a/core/themes/claro/templates/region--breadcrumb.html.twig b/core/themes/claro/templates/region--breadcrumb.html.twig
index a66f43131d60..e58c6a01a2d5 100644
--- a/core/themes/claro/templates/region--breadcrumb.html.twig
+++ b/core/themes/claro/templates/region--breadcrumb.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/olivero/olivero.theme b/core/themes/olivero/olivero.theme
index 88aa7531379c..8ddfb49b87ff 100644
--- a/core/themes/olivero/olivero.theme
+++ b/core/themes/olivero/olivero.theme
@@ -83,7 +83,7 @@ function olivero_preprocess_maintenance_page(&$variables): void {
// By default, site_name is set to Drupal if no db connection is available
// or during site installation. Setting site_name to an empty string makes
// the site and update pages look cleaner.
- // @see template_preprocess_maintenance_page
+ // @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
if (!$variables['db_is_active']) {
$variables['site_name'] = '';
}
diff --git a/core/themes/olivero/templates/dataset/item-list--search-results.html.twig b/core/themes/olivero/templates/dataset/item-list--search-results.html.twig
index 6bd6441738d6..665634e86885 100644
--- a/core/themes/olivero/templates/dataset/item-list--search-results.html.twig
+++ b/core/themes/olivero/templates/dataset/item-list--search-results.html.twig
@@ -17,7 +17,7 @@
* results, the following data is set:
* - plugin: The search plugin ID, for example "node_search".
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{%
diff --git a/core/themes/olivero/templates/dataset/item-list.html.twig b/core/themes/olivero/templates/dataset/item-list.html.twig
index 7c7a6e365bfe..06b1e2ebe4fe 100644
--- a/core/themes/olivero/templates/dataset/item-list.html.twig
+++ b/core/themes/olivero/templates/dataset/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if context.list_style %}
diff --git a/core/themes/olivero/templates/layout/region--breadcrumb.html.twig b/core/themes/olivero/templates/layout/region--breadcrumb.html.twig
index 5dbd5d45ffd7..a76183c62c4d 100644
--- a/core/themes/olivero/templates/layout/region--breadcrumb.html.twig
+++ b/core/themes/olivero/templates/layout/region--breadcrumb.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--content-above.html.twig b/core/themes/olivero/templates/layout/region--content-above.html.twig
index e50082ea3952..1a86195d928e 100644
--- a/core/themes/olivero/templates/layout/region--content-above.html.twig
+++ b/core/themes/olivero/templates/layout/region--content-above.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--content-below.html.twig b/core/themes/olivero/templates/layout/region--content-below.html.twig
index c0f9ed29e5e2..5cae5f8b825d 100644
--- a/core/themes/olivero/templates/layout/region--content-below.html.twig
+++ b/core/themes/olivero/templates/layout/region--content-below.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/olivero/templates/layout/region--content.html.twig b/core/themes/olivero/templates/layout/region--content.html.twig
index 7f86b5810362..60e53660b1f8 100644
--- a/core/themes/olivero/templates/layout/region--content.html.twig
+++ b/core/themes/olivero/templates/layout/region--content.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--footer-bottom.html.twig b/core/themes/olivero/templates/layout/region--footer-bottom.html.twig
index 36ffd885f95a..9677f84970ec 100644
--- a/core/themes/olivero/templates/layout/region--footer-bottom.html.twig
+++ b/core/themes/olivero/templates/layout/region--footer-bottom.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--footer-top.html.twig b/core/themes/olivero/templates/layout/region--footer-top.html.twig
index 8baaf314056c..c657df25ba3b 100644
--- a/core/themes/olivero/templates/layout/region--footer-top.html.twig
+++ b/core/themes/olivero/templates/layout/region--footer-top.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--header.html.twig b/core/themes/olivero/templates/layout/region--header.html.twig
index 8ecee6633649..47912006894d 100644
--- a/core/themes/olivero/templates/layout/region--header.html.twig
+++ b/core/themes/olivero/templates/layout/region--header.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--highlighted.html.twig b/core/themes/olivero/templates/layout/region--highlighted.html.twig
index 6c4293680741..b3dd5f2570c1 100644
--- a/core/themes/olivero/templates/layout/region--highlighted.html.twig
+++ b/core/themes/olivero/templates/layout/region--highlighted.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--primary-menu.html.twig b/core/themes/olivero/templates/layout/region--primary-menu.html.twig
index 32ade151fe6e..f1fa999007e3 100644
--- a/core/themes/olivero/templates/layout/region--primary-menu.html.twig
+++ b/core/themes/olivero/templates/layout/region--primary-menu.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--secondary-menu.html.twig b/core/themes/olivero/templates/layout/region--secondary-menu.html.twig
index ce7312194fe3..e64c0743b98b 100644
--- a/core/themes/olivero/templates/layout/region--secondary-menu.html.twig
+++ b/core/themes/olivero/templates/layout/region--secondary-menu.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region--sidebar.html.twig b/core/themes/olivero/templates/layout/region--sidebar.html.twig
index a3f88864f958..8b44262fee3a 100644
--- a/core/themes/olivero/templates/layout/region--sidebar.html.twig
+++ b/core/themes/olivero/templates/layout/region--sidebar.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/olivero/templates/layout/region--social.html.twig b/core/themes/olivero/templates/layout/region--social.html.twig
index 6f3cf697408d..dff6e3bbda7f 100644
--- a/core/themes/olivero/templates/layout/region--social.html.twig
+++ b/core/themes/olivero/templates/layout/region--social.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
diff --git a/core/themes/olivero/templates/layout/region.html.twig b/core/themes/olivero/templates/layout/region.html.twig
index 651a0112a56c..df39e7d8b451 100644
--- a/core/themes/olivero/templates/layout/region.html.twig
+++ b/core/themes/olivero/templates/layout/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/olivero/templates/maintenance-page.html.twig b/core/themes/olivero/templates/maintenance-page.html.twig
index f1c97e5c6e7f..cce49aea822a 100644
--- a/core/themes/olivero/templates/maintenance-page.html.twig
+++ b/core/themes/olivero/templates/maintenance-page.html.twig
@@ -5,7 +5,7 @@
*
* All available variables are mirrored in page.html.twig.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*/
#}
diff --git a/core/themes/olivero/templates/menu-local-action.html.twig b/core/themes/olivero/templates/menu-local-action.html.twig
index f78e6f538f9c..12bf7d27ec53 100644
--- a/core/themes/olivero/templates/menu-local-action.html.twig
+++ b/core/themes/olivero/templates/menu-local-action.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the wrapper element.
* - link: A rendered link element.
*
- * @see template_preprocess_menu_local_action()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalAction()
*
* @ingroup themeable
*/
diff --git a/core/themes/olivero/templates/navigation/menu-local-task.html.twig b/core/themes/olivero/templates/navigation/menu-local-task.html.twig
index 34bbb1c44d4c..50b71dabee56 100644
--- a/core/themes/olivero/templates/navigation/menu-local-task.html.twig
+++ b/core/themes/olivero/templates/navigation/menu-local-task.html.twig
@@ -12,7 +12,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*/
#}
<li{{ attributes.addClass('tabs__tab', is_active ? 'is-active') }}>
diff --git a/core/themes/stable9/templates/dataset/item-list.html.twig b/core/themes/stable9/templates/dataset/item-list.html.twig
index 86cc63670c92..4fceba2d0702 100644
--- a/core/themes/stable9/templates/dataset/item-list.html.twig
+++ b/core/themes/stable9/templates/dataset/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if context.list_style %}
diff --git a/core/themes/stable9/templates/dataset/table.html.twig b/core/themes/stable9/templates/dataset/table.html.twig
index d9e12ff284f8..89ab32c486e7 100644
--- a/core/themes/stable9/templates/dataset/table.html.twig
+++ b/core/themes/stable9/templates/dataset/table.html.twig
@@ -38,7 +38,7 @@
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
*/
#}
<table{{ attributes }}>
diff --git a/core/themes/stable9/templates/field/image.html.twig b/core/themes/stable9/templates/field/image.html.twig
index b342eee6dada..bb3d34e23210 100644
--- a/core/themes/stable9/templates/field/image.html.twig
+++ b/core/themes/stable9/templates/field/image.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the img tag.
* - style_name: (optional) The name of the image style applied.
*
- * @see template_preprocess_image()
+ * @see \Drupal\Core\Theme\ImagePreprocess::preprocessImage()
*/
#}
<img{{ attributes }} />
diff --git a/core/themes/stable9/templates/layout/install-page.html.twig b/core/themes/stable9/templates/layout/install-page.html.twig
index e2d3381e4858..3a7a346edfe6 100644
--- a/core/themes/stable9/templates/layout/install-page.html.twig
+++ b/core/themes/stable9/templates/layout/install-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_install_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessInstallPage()
*/
#}
<div class="layout-container">
diff --git a/core/themes/stable9/templates/layout/maintenance-page.html.twig b/core/themes/stable9/templates/layout/maintenance-page.html.twig
index de0acaabbbb4..cdbb3c0e11fe 100644
--- a/core/themes/stable9/templates/layout/maintenance-page.html.twig
+++ b/core/themes/stable9/templates/layout/maintenance-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*/
#}
<header role="banner">
diff --git a/core/themes/stable9/templates/layout/region.html.twig b/core/themes/stable9/templates/layout/region.html.twig
index e5e36d07410b..400b985d07f6 100644
--- a/core/themes/stable9/templates/layout/region.html.twig
+++ b/core/themes/stable9/templates/layout/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{% if content %}
diff --git a/core/themes/stable9/templates/navigation/menu-local-action.html.twig b/core/themes/stable9/templates/navigation/menu-local-action.html.twig
index 27872837abdc..138d29a00997 100644
--- a/core/themes/stable9/templates/navigation/menu-local-action.html.twig
+++ b/core/themes/stable9/templates/navigation/menu-local-action.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the wrapper element.
* - link: A rendered link element.
*
- * @see template_preprocess_menu_local_action()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalAction()
*/
#}
<li{{ attributes }}>{{ link }}</li>
diff --git a/core/themes/stable9/templates/navigation/menu-local-task.html.twig b/core/themes/stable9/templates/navigation/menu-local-task.html.twig
index b6c3ca241913..2bd91d6bf64f 100644
--- a/core/themes/stable9/templates/navigation/menu-local-task.html.twig
+++ b/core/themes/stable9/templates/navigation/menu-local-task.html.twig
@@ -11,7 +11,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*/
#}
<li{{ attributes }}>{{ link }}</li>
diff --git a/core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig b/core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig
index e9928fd77660..4940f047477e 100644
--- a/core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig
+++ b/core/themes/starterkit_theme/templates/dataset/item-list--search-results.html.twig
@@ -17,7 +17,7 @@
* results, the following data is set:
* - plugin: The search plugin ID, for example "node_search".
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{%
diff --git a/core/themes/starterkit_theme/templates/dataset/item-list.html.twig b/core/themes/starterkit_theme/templates/dataset/item-list.html.twig
index 20541b0b7e66..6e7b8e317b1d 100644
--- a/core/themes/starterkit_theme/templates/dataset/item-list.html.twig
+++ b/core/themes/starterkit_theme/templates/dataset/item-list.html.twig
@@ -16,7 +16,7 @@
* - context: A list of contextual data associated with the list. May contain:
* - list_style: The custom list style.
*
- * @see template_preprocess_item_list()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessItemList()
*/
#}
{% if context.list_style %}
diff --git a/core/themes/starterkit_theme/templates/dataset/table.html.twig b/core/themes/starterkit_theme/templates/dataset/table.html.twig
index cdfe0bff7e73..d7e6459bd4a4 100644
--- a/core/themes/starterkit_theme/templates/dataset/table.html.twig
+++ b/core/themes/starterkit_theme/templates/dataset/table.html.twig
@@ -38,7 +38,7 @@
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
- * @see template_preprocess_table()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessTable()
*/
#}
<table{{ attributes }}>
diff --git a/core/themes/starterkit_theme/templates/field/image.html.twig b/core/themes/starterkit_theme/templates/field/image.html.twig
index 31f782bb60a8..90d955c180a6 100644
--- a/core/themes/starterkit_theme/templates/field/image.html.twig
+++ b/core/themes/starterkit_theme/templates/field/image.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the img tag.
* - style_name: (optional) The name of the image style applied.
*
- * @see template_preprocess_image()
+ * @see \Drupal\Core\Theme\ImagePreprocess::preprocessImage()
*/
#}
{%
diff --git a/core/themes/starterkit_theme/templates/layout/maintenance-page.html.twig b/core/themes/starterkit_theme/templates/layout/maintenance-page.html.twig
index 7463b0238ca3..edd2783619b8 100644
--- a/core/themes/starterkit_theme/templates/layout/maintenance-page.html.twig
+++ b/core/themes/starterkit_theme/templates/layout/maintenance-page.html.twig
@@ -6,7 +6,7 @@
* All available variables are mirrored in page.html.twig.
* Some may be blank but they are provided for consistency.
*
- * @see template_preprocess_maintenance_page()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessMaintenancePage()
*/
#}
<div class="layout-container">
diff --git a/core/themes/starterkit_theme/templates/layout/region.html.twig b/core/themes/starterkit_theme/templates/layout/region.html.twig
index 95e71cec37e4..a4e8cc0af72a 100644
--- a/core/themes/starterkit_theme/templates/layout/region.html.twig
+++ b/core/themes/starterkit_theme/templates/layout/region.html.twig
@@ -9,7 +9,7 @@
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
- * @see template_preprocess_region()
+ * @see \Drupal\Core\Theme\ThemePreprocess::preprocessRegion()
*/
#}
{%
diff --git a/core/themes/starterkit_theme/templates/navigation/menu-local-action.html.twig b/core/themes/starterkit_theme/templates/navigation/menu-local-action.html.twig
index 27872837abdc..138d29a00997 100644
--- a/core/themes/starterkit_theme/templates/navigation/menu-local-action.html.twig
+++ b/core/themes/starterkit_theme/templates/navigation/menu-local-action.html.twig
@@ -7,7 +7,7 @@
* - attributes: HTML attributes for the wrapper element.
* - link: A rendered link element.
*
- * @see template_preprocess_menu_local_action()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalAction()
*/
#}
<li{{ attributes }}>{{ link }}</li>
diff --git a/core/themes/starterkit_theme/templates/navigation/menu-local-task.html.twig b/core/themes/starterkit_theme/templates/navigation/menu-local-task.html.twig
index b8559815b9e9..ce62d46c9f84 100644
--- a/core/themes/starterkit_theme/templates/navigation/menu-local-task.html.twig
+++ b/core/themes/starterkit_theme/templates/navigation/menu-local-task.html.twig
@@ -11,7 +11,7 @@
* Note: This template renders the content for each task item in
* menu-local-tasks.html.twig.
*
- * @see template_preprocess_menu_local_task()
+ * @see \Drupal\Core\Menu\MenuPreprocess::preprocessMenuLocalTask()
*/
#}
<li{{ attributes.addClass(is_active ? 'is-active') }}>{{ link }}</li>