summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php8
-rw-r--r--core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php14
-rw-r--r--core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php14
-rw-r--r--core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php6
-rw-r--r--core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php9
-rw-r--r--core/tests/Drupal/BuildTests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php (renamed from core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php)2
-rw-r--r--core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php15
-rw-r--r--core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php19
-rw-r--r--core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php13
-rw-r--r--core/tests/Drupal/BuildTests/QuickStart/QuickStartTest.php (renamed from core/tests/Drupal/Tests/Core/Command/QuickStartTest.php)21
-rw-r--r--core/tests/Drupal/BuildTests/QuickStart/RecipeQuickStartTest.php (renamed from core/tests/Drupal/Tests/Core/Recipe/RecipeQuickStartTest.php)23
-rw-r--r--core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php6
-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.php10
-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.php6
-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.php12
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php2
-rw-r--r--core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php6
-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/FunctionalTests/Asset/AssetOptimizationTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationUmamiTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Asset/UnversionedAssetTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php2
-rw-r--r--core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Components/ComponentRenderTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Config/SchemaConfigListenerTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php16
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php14
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php16
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php42
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php10
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/EntityUuidIdTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php22
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php23
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php29
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTranslatableTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php14
-rw-r--r--core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/FolderTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/HttpKernel/DestructableServiceTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallProfileUninstallTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigExistingSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoProfileTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstallTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php9
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php2
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageForeignTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageKeepEnglishTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php7
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/ProfileRequirementsTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php14
-rw-r--r--core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/MailCaptureTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlAnonTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlBasicAuthTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php5
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php8
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php6
-rw-r--r--core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php10
-rw-r--r--core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/Update/UpdateReducedThemeRegistryTest.php4
-rw-r--r--core/tests/Drupal/FunctionalTests/UserHelpersTest.php4
-rw-r--r--core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php3
-rw-r--r--core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php22
-rw-r--r--core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php4
-rw-r--r--core/tests/Drupal/KernelTests/Core/Config/ConfigExistsConstraintValidatorTest.php7
-rw-r--r--core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php14
-rw-r--r--core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php15
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php12
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php14
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php12
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/InsertTest.php4
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php109
-rw-r--r--core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php16
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php85
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php4
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php1
-rw-r--r--core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php4
-rw-r--r--core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php75
-rw-r--r--core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php3
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php8
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php9
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php32
-rw-r--r--core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php50
-rw-r--r--core/tests/Drupal/KernelTests/Core/Recipe/RecipeValidationTest.php30
-rw-r--r--core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php6
-rw-r--r--core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php25
-rw-r--r--core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php3
-rw-r--r--core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiFindAllClassFilesTest.php19
-rw-r--r--core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiGetTestClassesTest.php19
-rw-r--r--core/tests/Drupal/KernelTests/Core/Test/PhpUnitTestDiscoveryTest.php19
-rw-r--r--core/tests/Drupal/KernelTests/Core/Validation/UriHostValidatorTest.php74
-rw-r--r--core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php44
-rw-r--r--core/tests/Drupal/KernelTests/KernelTestBase.php4
-rw-r--r--core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/KernelTestBaseTest.php2
-rw-r--r--core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php2
-rw-r--r--core/tests/Drupal/Nightwatch/Tests/a11yTestAdmin.js31
-rw-r--r--core/tests/Drupal/Nightwatch/Tests/htmx/htmxTest.js54
-rw-r--r--core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php8
-rw-r--r--core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php2
-rw-r--r--core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php10
-rw-r--r--core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php10
-rw-r--r--core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php6
-rw-r--r--core/tests/Drupal/Tests/BrowserTestBase.php16
-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.php218
-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.php87
-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.php11
-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.php30
-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/Access/AccessGroupAndTest.php57
-rw-r--r--core/tests/Drupal/Tests/Core/Access/AccessResultTest.php8
-rw-r--r--core/tests/Drupal/Tests/Core/Access/AccessibleTestingTrait.php38
-rw-r--r--core/tests/Drupal/Tests/Core/Access/DependentAccessTest.php161
-rw-r--r--core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php92
-rw-r--r--core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerLazyUnitTest.php36
-rw-r--r--core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php130
-rw-r--r--core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php3
-rw-r--r--core/tests/Drupal/Tests/Core/Asset/css_test_files/css_external.optimized.aggregated.css1
-rw-r--r--core/tests/Drupal/Tests/Core/Config/ConfigTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php4
-rw-r--r--core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php28
-rw-r--r--core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php59
-rw-r--r--core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php88
-rw-r--r--core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php26
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php6
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/EntityViewBuilderTest.php80
-rw-r--r--core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php51
-rw-r--r--core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc5
-rw-r--r--core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Plugin/ConfigurablePluginBaseTest.php47
-rw-r--r--core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php205
-rw-r--r--core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php24
-rw-r--r--core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php26
-rw-r--r--core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php3
-rw-r--r--core/tests/Drupal/Tests/Core/Render/Element/ModernRenderElementTest.php60
-rw-r--r--core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php5
-rw-r--r--core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Render/RendererTest.php64
-rw-r--r--core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php8
-rw-r--r--core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php6
-rw-r--r--core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php371
-rw-r--r--core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php28
-rw-r--r--core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php3
-rw-r--r--core/tests/Drupal/Tests/DrupalTestBrowser.php4
-rw-r--r--core/tests/Drupal/Tests/RequirementsPageTrait.php10
-rw-r--r--core/tests/Drupal/Tests/SchemaCheckTestTrait.php4
-rw-r--r--core/tests/Drupal/Tests/UnitTestCase.php29
-rw-r--r--core/tests/Drupal/Tests/UpdatePathTestTrait.php6
-rw-r--r--core/tests/PHPStan/composer.json2
-rw-r--r--core/tests/fixtures/default_content/node/48475954-e878-439c-9d3d-226724a44269.yml47
-rw-r--r--core/tests/fixtures/default_content/workspace/inner_test.yml24
-rw-r--r--core/tests/fixtures/default_content/workspace/test_workspace.yml19
411 files changed, 4256 insertions, 1785 deletions
diff --git a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
index ee21d5bedf5..e943a257ee2 100644
--- a/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
+++ b/core/tests/Drupal/BuildTests/Command/GenerateThemeTest.php
@@ -8,6 +8,8 @@ use Drupal\BuildTests\QuickStart\QuickStartTestBase;
use Drupal\Core\Command\GenerateTheme;
use Drupal\Core\Serialization\Yaml;
use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
use Symfony\Component\Process\PhpExecutableFinder;
@@ -15,11 +17,9 @@ use Symfony\Component\Process\Process;
/**
* Tests the generate-theme commands.
- *
- * @requires extension pdo_sqlite
- *
- * @group Command
*/
+#[Group('Command')]
+#[RequiresPhpExtension('pdo_sqlite')]
class GenerateThemeTest extends QuickStartTestBase {
/**
diff --git a/core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php b/core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php
index 0042c55e160..8be768ed98c 100644
--- a/core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/Component/ComponentsIsolatedBuildTest.php
@@ -6,16 +6,17 @@ namespace Drupal\BuildTests\Composer\Component;
use Drupal\BuildTests\Composer\ComposerBuildTestBase;
use Drupal\Composer\Composer;
+use PHPUnit\Framework\Attributes\CoversNothing;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\Finder\Finder;
/**
* Try to install dependencies per component, using Composer.
- *
- * @group Composer
- * @group Component
- *
- * @coversNothing
*/
+#[CoversNothing]
+#[Group('Composer')]
+#[Group('Component')]
class ComponentsIsolatedBuildTest extends ComposerBuildTestBase {
/**
@@ -41,9 +42,8 @@ class ComponentsIsolatedBuildTest extends ComposerBuildTestBase {
/**
* Test whether components' composer.json can be installed in isolation.
- *
- * @dataProvider provideComponentPaths
*/
+ #[DataProvider('provideComponentPaths')]
public function testComponentComposerJson(string $component_path): void {
// Only copy the components. Copy all of them because some of them depend on
// each other.
diff --git a/core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php b/core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php
index 269edf126be..b50aa973c59 100644
--- a/core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/Component/ComponentsTaggedReleaseTest.php
@@ -6,15 +6,16 @@ namespace Drupal\BuildTests\Composer\Component;
use Drupal\BuildTests\Composer\ComposerBuildTestBase;
use Drupal\Composer\Composer;
+use PHPUnit\Framework\Attributes\CoversNothing;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Demonstrate that the Component generator responds to release tagging.
- *
- * @group Composer
- * @group Component
- *
- * @coversNothing
*/
+#[CoversNothing]
+#[Group('Composer')]
+#[Group('Component')]
class ComponentsTaggedReleaseTest extends ComposerBuildTestBase {
/**
@@ -37,9 +38,8 @@ class ComponentsTaggedReleaseTest extends ComposerBuildTestBase {
/**
* Validate release tagging and regeneration of dependencies.
- *
- * @dataProvider providerVersionConstraint
*/
+ #[DataProvider('providerVersionConstraint')]
public function testReleaseTagging(string $tag, string $constraint): void {
$this->copyCodebase();
$drupal_root = $this->getWorkspaceDirectory();
diff --git a/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php b/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php
index 7bdba7e4f4f..8ab2b3b9fc7 100644
--- a/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php
+++ b/core/tests/Drupal/BuildTests/Composer/ComposerBuildTestBase.php
@@ -5,13 +5,13 @@ declare(strict_types=1);
namespace Drupal\BuildTests\Composer;
use Drupal\BuildTests\Framework\BuildTestBase;
+use PHPUnit\Framework\Attributes\CoversNothing;
use Symfony\Component\Finder\Finder;
/**
* Base class for Composer build tests.
- *
- * @coversNothing
*/
+#[CoversNothing]
abstract class ComposerBuildTestBase extends BuildTestBase {
/**
@@ -36,7 +36,7 @@ abstract class ComposerBuildTestBase extends BuildTestBase {
$this->assertFileExists($drupal_php_path);
// Read back the Drupal version that was set and assert it matches
- // expectations
+ // expectations.
$this->executeCommand("php -r 'include \"$drupal_php_path\"; print \Drupal::VERSION;'");
$this->assertCommandSuccessful();
$this->assertCommandOutputContains($expectedVersion);
diff --git a/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php b/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php
index 661d159bf80..50c343354e1 100644
--- a/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/ComposerValidateTest.php
@@ -6,10 +6,13 @@ namespace Drupal\BuildTests\Composer;
use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\Tests\Composer\ComposerIntegrationTrait;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group Composer
+ * Tests.
*/
+#[Group('Composer')]
class ComposerValidateTest extends BuildTestBase {
use ComposerIntegrationTrait;
@@ -23,9 +26,7 @@ class ComposerValidateTest extends BuildTestBase {
return $data;
}
- /**
- * @dataProvider provideComposerJson
- */
+ #[DataProvider('provideComposerJson')]
public function testValidateComposer($path): void {
$this->executeCommand('composer validate --strict --no-check-all ' . $path);
$this->assertCommandSuccessful();
diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php b/core/tests/Drupal/BuildTests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
index b7434925689..1397a78cf69 100644
--- a/core/tests/Drupal/Tests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace Drupal\Tests\Composer\Plugin\Unpack\Functional;
+namespace Drupal\BuildTests\Composer\Plugin\Unpack\Functional;
use Composer\InstalledVersions;
use Composer\Util\Filesystem;
diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
index 6051afb1ae9..74b32658ba2 100644
--- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
+++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php
@@ -8,6 +8,8 @@ use Composer\Json\JsonFile;
use Composer\Semver\VersionParser;
use Drupal\BuildTests\Composer\ComposerBuildTestBase;
use Drupal\Composer\Composer;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Demonstrate that Composer project templates can be built as patched.
@@ -21,9 +23,8 @@ use Drupal\Composer\Composer;
*
* This is because Composer only uses the packages.json file to resolve the
* project template and not any other dependencies.
- *
- * @group Template
*/
+#[Group('Template')]
class ComposerProjectTemplatesTest extends ComposerBuildTestBase {
/**
@@ -31,7 +32,7 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase {
*
* @see https://getcomposer.org/doc/04-schema.md#minimum-stability
*/
- protected const MINIMUM_STABILITY = 'beta';
+ protected const MINIMUM_STABILITY = 'stable';
/**
* The order of stability strings from least stable to most stable.
@@ -171,11 +172,9 @@ class ComposerProjectTemplatesTest extends ComposerBuildTestBase {
}
}
- /**
- * @dataProvider provideTemplateCreateProject
- */
+ #[DataProvider('provideTemplateCreateProject')]
public function testTemplateCreateProject($project, $package_dir, $docroot_dir): void {
- // Make a working COMPOSER_HOME directory for setting global composer config
+ // Make a working COMPOSER_HOME directory for setting global composer config.
$composer_home = $this->getWorkspaceDirectory() . '/composer-home';
mkdir($composer_home);
// Create an empty global composer.json file, just to avoid warnings.
@@ -431,7 +430,7 @@ JSON;
}
$stability = VersionParser::parseStability($version);
if ($stability === 'dev') {
- // Strip off "-dev";
+ // Strip off "-dev".
$version_towards = substr($version, 0, -4);
if (!str_ends_with($version_towards, '.0')) {
diff --git a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
index 6e29abe18ee..388cc937254 100644
--- a/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
+++ b/core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
@@ -6,13 +6,16 @@ namespace Drupal\BuildTests\Framework\Tests;
use Drupal\BuildTests\Framework\BuildTestBase;
use org\bovigo\vfs\vfsStream;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
/**
- * @coversDefaultClass \Drupal\BuildTests\Framework\BuildTestBase
- * @group Build
+ * Tests Drupal\BuildTests\Framework\BuildTestBase.
*/
+#[CoversClass(BuildTestBase::class)]
+#[Group('Build')]
class BuildTestTest extends BuildTestBase {
/**
@@ -34,7 +37,7 @@ class BuildTestTest extends BuildTestBase {
}
/**
- * @covers ::copyCodebase
+ * @legacy-covers ::copyCodebase
*/
public function testCopyCodebase(): void {
$test_directory = 'copied_codebase';
@@ -56,7 +59,7 @@ class BuildTestTest extends BuildTestBase {
/**
* Ensure we're not copying directories we wish to exclude.
*
- * @covers ::copyCodebase
+ * @legacy-covers ::copyCodebase
*/
public function testCopyCodebaseExclude(): void {
// Create a virtual file system containing items that should be
@@ -129,7 +132,7 @@ class BuildTestTest extends BuildTestBase {
/**
* Tests copying codebase when Drupal and Composer roots are different.
*
- * @covers ::copyCodebase
+ * @legacy-covers ::copyCodebase
*/
public function testCopyCodebaseDocRoot(): void {
// Create a virtual file system containing items that should be
@@ -193,7 +196,7 @@ class BuildTestTest extends BuildTestBase {
$this->assertFileExists($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/default.settings.php');
$this->assertFileExists($full_path . DIRECTORY_SEPARATOR . 'vendor');
- // Verify expected files do not exist
+ // Verify expected files do not exist.
$this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/settings.php');
$this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/settings.local.php');
$this->assertFileDoesNotExist($full_path . DIRECTORY_SEPARATOR . 'docroot/sites/default/files');
@@ -206,7 +209,7 @@ class BuildTestTest extends BuildTestBase {
}
/**
- * @covers ::findAvailablePort
+ * @legacy-covers ::findAvailablePort
*/
public function testPortMany(): void {
$iterator = (new Finder())->in($this->getDrupalRoot())
@@ -234,7 +237,7 @@ class BuildTestTest extends BuildTestBase {
}
/**
- * @covers ::standUpServer
+ * @legacy-covers ::standUpServer
*/
public function testStandUpServer(): void {
// Stand up a server with working directory 'first'.
diff --git a/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php b/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
index f34f5e7f896..825cc6eaa46 100644
--- a/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
+++ b/core/tests/Drupal/BuildTests/Framework/Tests/HtRouterTest.php
@@ -4,18 +4,23 @@ declare(strict_types=1);
namespace Drupal\BuildTests\Framework\Tests;
+use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\BuildTests\QuickStart\QuickStartTestBase;
use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\RequiresPhpExtension;
/**
- * @coversDefaultClass \Drupal\BuildTests\Framework\BuildTestBase
- * @group Build
- * @requires extension pdo_sqlite
+ * Tests Drupal\BuildTests\Framework\BuildTestBase.
*/
+#[CoversClass(BuildTestBase::class)]
+#[Group('Build')]
+#[RequiresPhpExtension('pdo_sqlite')]
class HtRouterTest extends QuickStartTestBase {
/**
- * @covers ::instantiateServer
+ * @legacy-covers ::instantiateServer
*/
public function testHtRouter(): void {
$sqlite = (new \PDO('sqlite::memory:'))->query('select sqlite_version()')->fetch()[0];
diff --git a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php b/core/tests/Drupal/BuildTests/QuickStart/QuickStartTest.php
index c6fc8f18aa5..fbd0473b562 100644
--- a/core/tests/Drupal/Tests/Core/Command/QuickStartTest.php
+++ b/core/tests/Drupal/BuildTests/QuickStart/QuickStartTest.php
@@ -2,14 +2,18 @@
declare(strict_types=1);
-namespace Drupal\Tests\Core\Command;
+namespace Drupal\BuildTests\QuickStart;
use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
+use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\Core\Test\TestDatabase;
use Drupal\Tests\BrowserTestBase;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
-use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RequiresPhpExtension;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -18,15 +22,12 @@ use Symfony\Component\Process\Process;
*
* These tests are run in a separate process because they load Drupal code via
* an include.
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- * @requires extension pdo_sqlite
- *
- * @group Command
- * @group #slow
*/
-class QuickStartTest extends TestCase {
+#[Group('Command')]
+#[PreserveGlobalState(FALSE)]
+#[RequiresPhpExtension('pdo_sqlite')]
+#[RunTestsInSeparateProcesses]
+class QuickStartTest extends BuildTestBase {
/**
* The PHP executable path.
diff --git a/core/tests/Drupal/Tests/Core/Recipe/RecipeQuickStartTest.php b/core/tests/Drupal/BuildTests/QuickStart/RecipeQuickStartTest.php
index 65bedfff3d0..07d907bb8d0 100644
--- a/core/tests/Drupal/Tests/Core/Recipe/RecipeQuickStartTest.php
+++ b/core/tests/Drupal/BuildTests/QuickStart/RecipeQuickStartTest.php
@@ -2,14 +2,18 @@
declare(strict_types=1);
-namespace Drupal\Tests\Core\Recipe;
+namespace Drupal\BuildTests\QuickStart;
use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
+use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\Core\Test\TestDatabase;
use Drupal\Tests\BrowserTestBase;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
-use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RequiresPhpExtension;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
@@ -18,16 +22,13 @@ use Symfony\Component\Process\Process;
*
* These tests are run in a separate process because they load Drupal code via
* an include.
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- * @requires extension pdo_sqlite
- *
- * @group Command
- * @group Recipe
- * @group #slow
*/
-class RecipeQuickStartTest extends TestCase {
+#[Group('Command')]
+#[Group('Recipe')]
+#[PreserveGlobalState(FALSE)]
+#[RequiresPhpExtension('pdo_sqlite')]
+#[RunTestsInSeparateProcesses]
+class RecipeQuickStartTest extends BuildTestBase {
/**
* The PHP executable path.
diff --git a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
index bbcce3d2ca2..59622ab504f 100644
--- a/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
+++ b/core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php
@@ -6,13 +6,15 @@ namespace Drupal\BuildTests\TestSiteApplication;
use Drupal\BuildTests\Framework\BuildTestBase;
use Drupal\sqlite\Driver\Database\sqlite\Install\Tasks;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Process\PhpExecutableFinder;
/**
- * @group Build
- * @group TestSiteApplication
+ * Tests.
*/
+#[Group('Build')]
+#[Group('TestSiteApplication')]
class InstallTest extends BuildTestBase {
public function testInstall(): void {
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php
index d1c07c20124..1211cfb351b 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 b2ae9386bd0..1eff2c19bbe 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 c9a4b3ef272..347e8ac86f1 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 a80a627a89c..c11430fdebf 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 a8282b2b6cf..6618ec6aced 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 180381e45c1..3f4543996f1 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 03bd477123c..49c7d6987f7 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 {
/**
@@ -167,6 +167,12 @@ JS;
JS;
$expected = '<div class="div-wrapper-forever"></div>';
$this->assertInsert('empty', $expected, $custom_wrapper_new_content);
+
+ // Checking inserting table elements.
+ $expected = '<tr><td>table-row</td></tr>';
+ $this->drupalGet('ajax-test/insert-table-wrapper');
+ $this->clickLink('Link table-row');
+ $this->assertWaitPageContains('<div class="ajax-target-wrapper"><table><tbody id="ajax-target">' . $expected . '</tbody></table></div>');
}
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php
index cc81d142d45..877f255a659 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 be434633e5e..beab4c6a242 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 60fd1f40b95..5040430abae 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 7a9b91c52b9..2a27a09a987 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 2ee6b8ddb2c..68a9683a490 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 69b49916163..f18bf953dd8 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 6a0026976a9..40ed7ac7670 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 6b2a17d4c6e..92905a0c08b 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 0a61c5f03cb..adade6bc420 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 2f11f7525ee..74c88ac48ee 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 5b77de188aa..95847a5d229 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 f16b300441d..3684ec3c497 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 53b2c5dcb7a..6e615f4b4f9 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 0b517618239..f35b5c72171 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 7c8af15a2e3..f538690daf9 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 189af6e49e6..ac41f01653f 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 ce4cf583cd8..4acec8e1110 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 31f04417586..b990be12549 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 {
/**
@@ -196,7 +196,7 @@ class MachineNameTest extends WebDriverTestBase {
$assert->fieldExists('Name')->setValue('test 1');
$machine_name_value = $page->find('css', '#edit-name-machine-name-suffix .machine-name-value');
$this->assertNotEmpty($machine_name_value, 'Machine name field must be initialized');
- $this->assertJsCondition('jQuery("#edit-name-machine-name-suffix .machine-name-value").html() == "' . 'test_1' . '"');
+ $this->assertJsCondition('jQuery("#edit-name-machine-name-suffix .machine-name-value").html() == "test_1"');
// Ensure that machine name generation still occurs after a non-HTML 5
// validation failure.
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php
index 8adf7a5685a..94387c04633 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 abc6fd4c5ca..2085b551841 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 ed73ac1ff70..abda27ed3b7 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 971af632a99..18fe44d8c4c 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 e45026d8960..cb2fce7a36c 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 a310d4c9e6e..c67e27551c0 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 3fb35552340..5f96e95dc2b 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 31ec8c91675..8054a739599 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 ad9ba4f89d8..9bf96e4fbf4 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') {
@@ -80,6 +79,7 @@ class MachineNameTransliterationTest extends WebDriverTestBase {
['fr', 'ᐑ', 'wii'],
// This test is not working with chromedriver as '𐌰𐌸' chars are not
// accepted.
+ // phpcs:ignore Drupal.Commenting.InlineComment.InvalidEndChar
// ['en', '𐌰𐌸', '__'],
['en', 'Ä Ö Ü Å Ø äöüåøhello', 'a_o_u_a_o_aouaohello'],
['de', 'Ä Ö Ü Å Ø äöüåøhello', 'ae_oe_ue_a_o_aeoeueaohello'],
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
index d624e03c00d..60f7b44fe0f 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/PerformanceTestBase.php
@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @ingroup testing
*/
-class PerformanceTestBase extends WebDriverTestBase {
+abstract class PerformanceTestBase extends WebDriverTestBase {
use PerformanceTestTrait;
/**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php b/core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php
index a9350a1976e..73365503305 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 {
/**
@@ -107,7 +107,7 @@ class TableDragTest extends WebDriverTestBase {
$session = $this->getSession();
$page = $session->getPage();
- // Confirm touchevents detection is loaded with Tabledrag
+ // Confirm touchevents detection is loaded with Tabledrag.
$this->assertNotNull($this->assertSession()->waitForElement('css', 'html.no-touchevents'));
$weight_select1 = $page->findField("table[1][weight]");
$weight_select2 = $page->findField("table[2][weight]");
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Tests/DrupalSelenium2DriverTest.php
index 1ab9d65b3be..e598f5cc04a 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 866f04e3a72..a8018c7b013 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 f200ed28ac9..6388bd0844e 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 dbc7874c735..62ae39c4db4 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 85476468d81..c8e018ebfbe 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 32f6256396b..930c7f963a7 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 c78ff99c80a..7f110c1a428 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 af01db8d2a8..c090f658dc5 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 9938ad22d09..7dda74a5348 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 e752b79a65a..3f6c21ad875 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 28b3c46a999..67474ad08a6 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 ee1261a354b..24d3ca85af2 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 6b0472702c0..74278efdf4b 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/FunctionalTests/Asset/AssetOptimizationTest.php b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
index 96980a2c605..580e7ad1a13 100644
--- a/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationTest.php
@@ -6,14 +6,13 @@ namespace Drupal\FunctionalTests\Asset;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore abcdefghijklmnop
-
/**
* Tests asset aggregation.
- *
- * @group asset
*/
+#[Group('asset')]
class AssetOptimizationTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationUmamiTest.php b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationUmamiTest.php
index 5951ac94531..214ecd80053 100644
--- a/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationUmamiTest.php
+++ b/core/tests/Drupal/FunctionalTests/Asset/AssetOptimizationUmamiTest.php
@@ -4,16 +4,17 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Asset;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests asset aggregation with the Umami install profile.
*
* Umami includes several core modules as well as the Claro theme, this
* results in a more complex asset dependency tree to test than the testing
* profile.
- *
- * @group asset
- * @group #slow
*/
+#[Group('asset')]
+#[Group('#slow')]
class AssetOptimizationUmamiTest extends AssetOptimizationTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Asset/UnversionedAssetTest.php b/core/tests/Drupal/FunctionalTests/Asset/UnversionedAssetTest.php
index a2f84544ff5..00e05246700 100644
--- a/core/tests/Drupal/FunctionalTests/Asset/UnversionedAssetTest.php
+++ b/core/tests/Drupal/FunctionalTests/Asset/UnversionedAssetTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Asset;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests asset aggregation.
- *
- * @group asset
*/
+#[Group('asset')]
class UnversionedAssetTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
index 80fd287751c..cac1c8bcedc 100644
--- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
+++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Bootstrap;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests kernel panic when things are really messed up.
- *
- * @group system
*/
+#[Group('system')]
class UncaughtExceptionTest extends BrowserTestBase {
/**
@@ -203,6 +203,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
switch ($this->container->get('database')->driver()) {
case 'pgsql':
case 'mysql':
+ case 'mysqli':
$this->expectedExceptionMessage = $incorrect_username;
break;
@@ -245,7 +246,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
$this->assertSession()->pageTextContains('The website encountered an unexpected error. Try again later.');
$this->assertSession()->pageTextContains($this->expectedExceptionMessage);
- // Find fatal error logged to the error.log
+ // Find fatal error logged to the error.log.
$errors = file(\Drupal::root() . '/' . $this->siteDirectory . '/error.log');
$this->assertCount(10, $errors, 'The error + the error that the logging service is broken has been written to the error log.');
$this->assertStringContainsString('Failed to log error', $errors[0], 'The error handling logs when an error could not be logged to the logger.');
diff --git a/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
index b38a93c2565..6bf8bad3ec4 100644
--- a/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
+++ b/core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Breadcrumb;
use Drupal\Tests\block\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the breadcrumb of 404 pages.
- *
- * @group breadcrumb
*/
+#[Group('breadcrumb')]
class Breadcrumb404Test extends BrowserTestBase {
use BlockCreationTrait;
diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
index 54bb662e211..ed4a7f750ba 100644
--- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
@@ -491,7 +491,7 @@ class BrowserTestBaseTest extends BrowserTestBase {
*/
public function testLocalTimeZone(): void {
$expected = 'Australia/Sydney';
- // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+ // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php.
$this->assertEquals($expected, date_default_timezone_get());
// The 'Australia/Sydney' time zone is also set in
diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php
index cf48655458b..6e8720a8d40 100644
--- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php
+++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests BrowserTestBase functionality.
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class BrowserTestBaseUserAgentTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Components/ComponentRenderTest.php b/core/tests/Drupal/FunctionalTests/Components/ComponentRenderTest.php
index 963661a0cc8..e379f4252ef 100644
--- a/core/tests/Drupal/FunctionalTests/Components/ComponentRenderTest.php
+++ b/core/tests/Drupal/FunctionalTests/Components/ComponentRenderTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Components;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the correct rendering of components.
- *
- * @group sdc
*/
+#[Group('sdc')]
class ComponentRenderTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Core/Config/SchemaConfigListenerTest.php b/core/tests/Drupal/FunctionalTests/Core/Config/SchemaConfigListenerTest.php
index d42b356c641..7f191e478fe 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Config/SchemaConfigListenerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Config/SchemaConfigListenerTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Core\Config;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\Config\SchemaConfigListenerTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the functionality of ConfigSchemaChecker in BrowserTestBase tests.
- *
- * @group config
*/
+#[Group('config')]
class SchemaConfigListenerTest extends BrowserTestBase {
use SchemaConfigListenerTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php b/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php
index d441c23d307..4394363c159 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php
@@ -4,7 +4,11 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Core\Container;
+use Drupal\Component\DependencyInjection\Container;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
/**
* Test whether deprecation notices are triggered via \Drupal::service().
@@ -12,12 +16,10 @@ use Drupal\Tests\BrowserTestBase;
* Note: this test must be a BrowserTestBase so the container is properly
* compiled. The container in KernelTestBase tests is always an instance of
* \Drupal\Core\DependencyInjection\ContainerBuilder.
- *
- * @group Container
- * @group legacy
- *
- * @coversDefaultClass \Drupal\Component\DependencyInjection\Container
*/
+#[CoversClass(Container::class)]
+#[Group('Container')]
+#[IgnoreDeprecations]
class ServiceDeprecationTest extends BrowserTestBase {
/**
@@ -31,7 +33,9 @@ class ServiceDeprecationTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
/**
- * @covers ::get
+ * Tests get deprecated.
+ *
+ * @legacy-covers ::get
*/
public function testGetDeprecated(): void {
$this->expectDeprecation('The "deprecation_test.service" service is deprecated in drupal:9.0.0 and is removed from drupal:20.0.0. This is a test.');
diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php
index 882658558f7..d2e1684d999 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeCommandTest.php
@@ -6,16 +6,18 @@ namespace Drupal\FunctionalTests\Core\Recipe;
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Config\Checkpoint\Checkpoint;
+use Drupal\Core\Recipe\RecipeCommand;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests recipe command.
*
* BrowserTestBase is used for a proper Drupal install.
- *
- * @coversDefaultClass \Drupal\Core\Recipe\RecipeCommand
- * @group Recipe
*/
+#[CoversClass(RecipeCommand::class)]
+#[Group('Recipe')]
class RecipeCommandTest extends BrowserTestBase {
use RecipeTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php
index f279b988c6f..2ba1abff2d2 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php
@@ -8,10 +8,13 @@ use Drupal\Core\Config\Checkpoint\Checkpoint;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Recipe\Recipe;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\TestWith;
/**
- * @group Recipe
+ * Tests Rollback.
*/
+#[Group('Recipe')]
class RollbackTest extends BrowserTestBase {
use RecipeTestTrait;
@@ -39,10 +42,11 @@ class RollbackTest extends BrowserTestBase {
];
/**
- * @testWith ["invalid_config", "core.date_format.invalid"]
- * ["recipe_depend_on_invalid", "core.date_format.invalid"]
- * ["recipe_depend_on_invalid_config_and_valid_modules", "core.date_format.invalid"]
- */
+ * Tests rollback for invalid config.
+ */
+ #[TestWith(["invalid_config", "core.date_format.invalid"])]
+ #[TestWith(["recipe_depend_on_invalid", "core.date_format.invalid"])]
+ #[TestWith(["recipe_depend_on_invalid_config_and_valid_modules", "core.date_format.invalid"])]
public function testRollbackForInvalidConfig(string $recipe_fixture, string $expected_invalid_config_name): void {
$expected_core_extension_modules = $this->config('core.extension')->get('module');
diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php
index e7509aa8528..630b62e1e9e 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php
@@ -8,15 +8,15 @@ use Drupal\contact\Entity\ContactForm;
use Drupal\FunctionalTests\Installer\InstallerTestBase;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\Tests\standard\Traits\StandardTestTrait;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Yaml\Yaml as SymfonyYaml;
/**
* Tests installing the Standard recipe via the installer.
- *
- * @group #slow
- * @group Recipe
*/
+#[Group('#slow')]
+#[Group('Recipe')]
class StandardRecipeInstallTest extends InstallerTestBase {
use StandardTestTrait {
testStandard as doTestStandard;
@@ -46,7 +46,7 @@ class StandardRecipeInstallTest extends InstallerTestBase {
*/
protected function visitInstaller(): void {
// Use a URL to install from a recipe.
- $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?profile=&recipe=core/recipes/standard');
+ $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?profile=&recipe=core/recipes/standard');
}
/**
diff --git a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php
index 4bf46e8d491..b6d86e2754e 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeTest.php
@@ -4,16 +4,17 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Core\Recipe;
+use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\Tests\standard\Functional\StandardTest;
use Drupal\user\RoleInterface;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests Standard recipe installation expectations.
- *
- * @group #slow
- * @group Recipe
*/
+#[Group('#slow')]
+#[Group('Recipe')]
class StandardRecipeTest extends StandardTest {
use RecipeTestTrait;
@@ -35,7 +36,12 @@ class StandardRecipeTest extends StandardTest {
$theme_installer->uninstall(['claro', 'olivero']);
// Determine which modules to uninstall.
- $uninstall = array_diff(array_keys(\Drupal::moduleHandler()->getModuleList()), ['user', 'system', 'path_alias', \Drupal::database()->getProvider()]);
+ // If the database module has dependencies, they are expected too.
+ $database_module_extension = \Drupal::service(ModuleExtensionList::class)->get(\Drupal::database()->getProvider());
+ $database_modules = $database_module_extension->requires ? array_keys($database_module_extension->requires) : [];
+ $database_modules[] = \Drupal::database()->getProvider();
+ $keep = array_merge(['user', 'system', 'path_alias'], $database_modules);
+ $uninstall = array_diff(array_keys(\Drupal::moduleHandler()->getModuleList()), $keep);
foreach (['shortcut', 'field_config', 'filter_format', 'field_storage_config'] as $entity_type) {
$storage = \Drupal::entityTypeManager()->getStorage($entity_type);
$storage->delete($storage->loadMultiple());
@@ -115,7 +121,7 @@ class StandardRecipeTest extends StandardTest {
// Ensure we have truly rebuilt the standard profile using recipes.
// Uncomment the code below to see the differences in a single file.
- // phpcs:ignore Drupal.Files.LineLength
+ // phpcs:ignore Drupal.Commenting.InlineComment.InvalidEndChar, Drupal.Files.LineLength
// $this->assertSame($sync->read('node.settings'), $active->read('node.settings'));
$comparer = $this->configImporter()->getStorageComparer();
$expected_list = $comparer->getEmptyChangelist();
diff --git a/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php b/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php
index 387250f43e3..01ca5484867 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Test/ModuleInstallBatchTest.php
@@ -6,16 +6,16 @@ namespace Drupal\FunctionalTests\Core\Test;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests batch operations during tests execution.
*
* This demonstrates that a batch will be successfully executed during module
* installation when running tests.
- *
- * @group Test
- * @group FunctionalTestSetupTrait
*/
+#[Group('Test')]
+#[Group('FunctionalTestSetupTrait')]
class ModuleInstallBatchTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php b/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
index cf4eab8d67e..aec48cfacfb 100644
--- a/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
+++ b/core/tests/Drupal/FunctionalTests/Core/Test/PhpUnitBridgeTest.php
@@ -6,13 +6,14 @@ namespace Drupal\FunctionalTests\Core\Test;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
/**
* Tests Drupal's extension to manage code deprecation.
- *
- * @group Test
- * @group legacy
*/
+#[Group('Test')]
+#[IgnoreDeprecations]
class PhpUnitBridgeTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php
index 57b4191a7fd..bf3319c93bc 100644
--- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php
+++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php
@@ -9,12 +9,12 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the functionality of TimestampAgoFormatter core field formatter.
- *
- * @group field
*/
+#[Group('field')]
class TimestampAgoFormatterTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
index 09ce9544c30..564b3a9bbd4 100644
--- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
+++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
@@ -11,12 +11,12 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the functionality of Timestamp core field UI.
- *
- * @group field
*/
+#[Group('field')]
class TimestampTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php
index f7509fd7277..3a876401d42 100644
--- a/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php
+++ b/core/tests/Drupal/FunctionalTests/DefaultContent/ContentImportTest.php
@@ -8,12 +8,12 @@ use ColinODell\PsrTestLogger\TestLogger;
use Drupal\block_content\BlockContentInterface;
use Drupal\block_content\Entity\BlockContentType;
use Drupal\Component\Serialization\Yaml;
-use Drupal\Core\DefaultContent\PreImportEvent;
use Drupal\Core\DefaultContent\Existing;
use Drupal\Core\DefaultContent\Finder;
use Drupal\Core\DefaultContent\Importer;
use Drupal\Core\DefaultContent\ImportException;
use Drupal\Core\DefaultContent\InvalidEntityException;
+use Drupal\Core\DefaultContent\PreImportEvent;
use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\File\FileExists;
@@ -35,15 +35,20 @@ use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;
use Drupal\user\UserInterface;
+use Drupal\workspaces\Entity\Workspace;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
use Psr\Log\LogLevel;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
/**
- * @covers \Drupal\Core\DefaultContent\Importer
- * @group DefaultContent
- * @group Recipe
- * @group #slow
+ * Tests Content Import.
+ *
+ * @legacy-covers \Drupal\Core\DefaultContent\Importer
*/
+#[Group('DefaultContent')]
+#[Group('Recipe')]
+#[Group('#slow')]
class ContentImportTest extends BrowserTestBase {
use EntityReferenceFieldCreationTrait;
@@ -72,6 +77,7 @@ class ContentImportTest extends BrowserTestBase {
'system',
'taxonomy',
'user',
+ 'workspaces',
];
/**
@@ -144,8 +150,9 @@ class ContentImportTest extends BrowserTestBase {
}
/**
- * @dataProvider providerImportEntityThatAlreadyExists
- */
+ * Tests import entity that already exists.
+ */
+ #[DataProvider('providerImportEntityThatAlreadyExists')]
public function testImportEntityThatAlreadyExists(Existing $existing): void {
$this->drupalCreateUser(values: ['uuid' => '94503467-be7f-406c-9795-fc25baa22203']);
@@ -180,6 +187,22 @@ class ContentImportTest extends BrowserTestBase {
);
};
$this->assertTrue($logger->hasRecordThatPasses($predicate, LogLevel::WARNING));
+
+ // Visit a page that is published in a non-live workspace; we should not be
+ // able to see it, because we don't have permission.
+ $node_in_workspace = $this->container->get(EntityRepositoryInterface::class)
+ ->loadEntityByUuid('node', '48475954-e878-439c-9d3d-226724a44269');
+ $this->assertInstanceOf(NodeInterface::class, $node_in_workspace);
+ $node_url = $node_in_workspace->toUrl();
+ $this->drupalGet($node_url);
+ $assert_session = $this->assertSession();
+ $assert_session->statusCodeEquals(403);
+ // If we log in with administrative privileges (i.e., we can look at any
+ // workspace), we should be able to see it.
+ $this->drupalLogin($this->adminAccount);
+ $this->drupalGet($node_url);
+ $assert_session->statusCodeEquals(200);
+ $assert_session->pageTextContains($node_in_workspace->label());
}
/**
@@ -303,6 +326,11 @@ class ContentImportTest extends BrowserTestBase {
$this->assertInstanceOf(Section::class, $section);
$this->assertCount(2, $section->getComponents());
$this->assertSame('system_powered_by_block', $section->getComponent('03b45f14-cf74-469a-8398-edf3383ce7fa')->getPluginId());
+
+ // Workspaces should have been imported with their parent references intact.
+ $workspaces = Workspace::loadMultiple();
+ $this->assertArrayHasKey('test_workspace', $workspaces);
+ $this->assertSame('test_workspace', $workspaces['inner_test']?->parent->entity->id());
}
/**
diff --git a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php
index 62f25442865..b5bfb865c68 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest.php
@@ -8,12 +8,12 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the correct mapping of user input on the correct field delta elements.
- *
- * @group Entity
*/
+#[Group('Entity')]
class ContentEntityFormCorrectUserInputMappingOnFieldDeltaElementsTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php
index 7108b212bf1..9d40cbe111c 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/ContentEntityFormFieldValidationFilteringTest.php
@@ -9,12 +9,12 @@ use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\TestFileCreationTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests field validation filtering on content entity forms.
- *
- * @group Entity
*/
+#[Group('Entity')]
class ContentEntityFormFieldValidationFilteringTest extends BrowserTestBase {
use TestFileCreationTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php
index f65f4d2ddb3..b51d4042a96 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/DeleteMultipleFormTest.php
@@ -9,14 +9,16 @@ use Drupal\entity_test\Entity\EntityTestMulRevPub;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
/**
* Tests the delete multiple confirmation form.
- *
- * @group Entity
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
*/
+#[Group('Entity')]
+#[PreserveGlobalState(FALSE)]
+#[RunTestsInSeparateProcesses]
class DeleteMultipleFormTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php b/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php
index 85a2fbcd3fe..88c3f9ed314 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/EntityBundleListCacheTest.php
@@ -9,12 +9,12 @@ use Drupal\entity_test\Entity\EntityTestBundle;
use Drupal\entity_test\Entity\EntityTestWithBundle;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that bundle tags are invalidated when entities change.
- *
- * @group Entity
*/
+#[Group('Entity')]
class EntityBundleListCacheTest extends BrowserTestBase {
use AssertPageCacheContextsAndTagsTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Entity/EntityUuidIdTest.php b/core/tests/Drupal/FunctionalTests/Entity/EntityUuidIdTest.php
index d6bdff7c090..51494401479 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/EntityUuidIdTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/EntityUuidIdTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalTests\Entity;
use Drupal\Component\Uuid\Uuid;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that an entity with a UUID as ID can be managed.
- *
- * @group Entity
*/
+#[Group('Entity')]
class EntityUuidIdTest extends BrowserTestBase {
use ContentTranslationTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php
index e5901e52fa4..a2e750974ae 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php
@@ -4,18 +4,20 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
+use Drupal\Core\Entity\Form\RevisionDeleteForm;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\entity_test\Entity\EntityTestRevPub;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests deleting a revision with revision delete form.
- *
- * @group Entity
- * @group #slow
- * @coversDefaultClass \Drupal\Core\Entity\Form\RevisionDeleteForm
*/
+#[CoversClass(RevisionDeleteForm::class)]
+#[Group('Entity')]
+#[Group('#slow')]
class RevisionDeleteFormTest extends BrowserTestBase {
/**
@@ -59,7 +61,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
* @param string $expectedQuestion
* The expected question/page title.
*
- * @covers ::getQuestion
+ * @legacy-covers ::getQuestion
*/
protected function doTestPageTitle(string $entityTypeId, string $expectedQuestion): void {
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
@@ -105,7 +107,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
/**
* Test cannot delete latest revision.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
public function testAccessDeleteLatestDefault(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -132,7 +134,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
/**
* Ensure that forward revision can be deleted.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessDeleteLatestForwardRevision(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRevPub $entity */
@@ -158,7 +160,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
/**
* Test cannot delete default revision.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessDeleteDefault(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRevPub $entity */
@@ -193,7 +195,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
/**
* Test can delete non-latest revision.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessDeleteNonLatest(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -244,7 +246,7 @@ class RevisionDeleteFormTest extends BrowserTestBase {
* @param string|int $expectedDestination
* Expected destination after deletion.
*
- * @covers ::submitForm
+ * @legacy-covers ::submitForm
*/
protected function doTestSubmitForm(array $permissions, string $entityTypeId, string $entityLabel, int $totalRevisions, array $expectedLog, string $expectedMessage, $expectedDestination): void {
if (count($permissions) > 0) {
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
index 8ca59b6100e..61b08c8f439 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
@@ -4,19 +4,22 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
+use Drupal\Core\Entity\Form\RevisionRevertForm;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\entity_test\Entity\EntityTestRevPub;
use Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests reverting a revision with revision revert form.
- *
- * @group Entity
- * @group #slow
- * @coversDefaultClass \Drupal\Core\Entity\Form\RevisionRevertForm
*/
+#[CoversClass(RevisionRevertForm::class)]
+#[Group('Entity')]
+#[Group('#slow')]
class RevisionRevertFormTest extends BrowserTestBase {
/**
@@ -107,7 +110,7 @@ class RevisionRevertFormTest extends BrowserTestBase {
/**
* Test cannot revert latest default revision.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessRevertLatestDefault(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -126,7 +129,7 @@ class RevisionRevertFormTest extends BrowserTestBase {
/**
* Ensures that forward revisions can be reverted.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessRevertLatestForwardRevision(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -150,7 +153,7 @@ class RevisionRevertFormTest extends BrowserTestBase {
/**
* Test can revert non-latest revision.
*
- * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
+ * @legacy-covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess
*/
protected function testAccessRevertNonLatest(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -188,9 +191,9 @@ class RevisionRevertFormTest extends BrowserTestBase {
* @param string $expectedDestination
* Expected destination after deletion.
*
- * @covers ::submitForm
- * @dataProvider providerSubmitForm
+ * @legacy-covers ::submitForm
*/
+ #[DataProvider('providerSubmitForm')]
public function testSubmitForm(array $permissions, string $entityTypeId, string $entityLabel, array $expectedLog, string $expectedMessage, string $expectedDestination): void {
if (count($permissions) > 0) {
$this->drupalLogin($this->createUser($permissions));
@@ -302,7 +305,7 @@ class RevisionRevertFormTest extends BrowserTestBase {
/**
* Tests the revert process.
*
- * @covers ::prepareRevision
+ * @legacy-covers ::prepareRevision
*/
protected function testPrepareRevision(): void {
$user = $this->createUser();
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php
index e59fe25e25e..6843860b1b8 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php
@@ -4,15 +4,17 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
+use Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests revision route provider.
- *
- * @group Entity
- * @coversDefaultClass \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider
*/
+#[CoversClass(RevisionHtmlRouteProvider::class)]
+#[Group('Entity')]
class RevisionRouteProviderTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php
index a5b9e966766..67b99d3072a 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php
@@ -8,14 +8,15 @@ use Drupal\Core\Entity\Controller\VersionHistoryController;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests version history page.
- *
- * @group Entity
- * @group #slow
- * @coversDefaultClass \Drupal\Core\Entity\Controller\VersionHistoryController
*/
+#[CoversClass(VersionHistoryController::class)]
+#[Group('Entity')]
+#[Group('#slow')]
class RevisionVersionHistoryTest extends BrowserTestBase {
/**
@@ -66,7 +67,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test current revision is indicated.
*
- * @covers \Drupal\Core\Entity\Controller\VersionHistoryController::revisionOverview
+ * @legacy-covers \Drupal\Core\Entity\Controller\VersionHistoryController::revisionOverview
*/
public function testCurrentRevision(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -95,7 +96,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test description with entity implementing revision log.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionRevLog(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
@@ -114,7 +115,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test description with entity implementing revision log, with empty values.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionRevLogNullValues(): void {
$entity = EntityTestWithRevisionLog::create(['type' => 'entity_test_revlog']);
@@ -133,7 +134,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test description with entity, without revision log, no label access.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionNoRevLogNoLabelAccess(): void {
/** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
@@ -149,7 +150,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test description with entity, without revision log, with label access.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionNoRevLogWithLabelAccess(): void {
// Permission grants 'view label' access.
@@ -168,7 +169,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test revision link, without access to revision page.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionLinkNoAccess(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
@@ -187,7 +188,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
* Test two revisions. Usually the latest revision only checks canonical
* route access, whereas all others will check individual revision access.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionLinkWithAccess(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
@@ -216,7 +217,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test revision log message if supported, and HTML tags are stripped.
*
- * @covers ::getRevisionDescription
+ * @legacy-covers ::getRevisionDescription
*/
public function testDescriptionRevisionLogMessage(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
@@ -233,7 +234,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test revert operation.
*
- * @covers ::buildRevertRevisionLink
+ * @legacy-covers ::buildRevertRevisionLink
*/
public function testOperationRevertRevision(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
@@ -273,7 +274,7 @@ class RevisionVersionHistoryTest extends BrowserTestBase {
/**
* Test delete operation.
*
- * @covers ::buildDeleteRevisionLink
+ * @legacy-covers ::buildDeleteRevisionLink
*/
public function testOperationDeleteRevision(): void {
/** @var \Drupal\entity_test_revlog\Entity\EntityTestWithRevisionLog $entity */
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTranslatableTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTranslatableTest.php
index 2625feb5ec3..7146a489a3d 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTranslatableTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTranslatableTest.php
@@ -4,16 +4,18 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
+use Drupal\Core\Entity\Controller\VersionHistoryController;
use Drupal\entity_test_revlog\Entity\EntityTestMulWithRevisionLog;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests version history page with translations.
- *
- * @group Entity
- * @coversDefaultClass \Drupal\Core\Entity\Controller\VersionHistoryController
*/
+#[CoversClass(VersionHistoryController::class)]
+#[Group('Entity')]
final class RevisionVersionHistoryTranslatableTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php b/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php
index e39c1f36f60..bc219184c8b 100644
--- a/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php
+++ b/core/tests/Drupal/FunctionalTests/Entity/RevisionViewTest.php
@@ -4,17 +4,20 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
+use Drupal\Core\Entity\Controller\EntityRevisionViewController;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\CoversClass;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests revision view page.
- *
- * @group Entity
- * @coversDefaultClass \Drupal\Core\Entity\Controller\EntityRevisionViewController
*/
+#[CoversClass(EntityRevisionViewController::class)]
+#[Group('Entity')]
class RevisionViewTest extends BrowserTestBase {
/**
@@ -48,10 +51,9 @@ class RevisionViewTest extends BrowserTestBase {
* @param string $expectedPageTitle
* Expected page title.
*
- * @covers ::__invoke
- *
- * @dataProvider providerRevisionPage
+ * @legacy-covers ::__invoke
*/
+ #[DataProvider('providerRevisionPage')]
public function testRevisionPage(string $entityTypeId, string $expectedPageTitle): void {
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage($entityTypeId);
diff --git a/core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php b/core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php
index 77c9b0f00b7..3ca22f19760 100644
--- a/core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php
+++ b/core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php
@@ -6,14 +6,14 @@ namespace Drupal\FunctionalTests\EventSubscriber;
use Drupal\file\Entity\File;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the fast 404 functionality.
*
- * @group EventSubscriber
- *
* @see \Drupal\Core\EventSubscriber\Fast404ExceptionHtmlSubscriber
*/
+#[Group('EventSubscriber')]
class Fast404Test extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php b/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php
index 01c694b4ef4..e18073c3150 100644
--- a/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php
+++ b/core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php
@@ -7,10 +7,12 @@ namespace Drupal\FunctionalTests;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Database;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group Database
+ * Tests Existing Drupal8Style Database Connection In Settings Php.
*/
+#[Group('Database')]
class ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest extends BrowserTestBase {
/**
@@ -26,7 +28,7 @@ class ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest extends BrowserTes
$driver = Database::getConnection()->driver();
if (!in_array($driver, ['mysql', 'pgsql', 'sqlite'])) {
- $this->markTestSkipped("This test does not support the {$driver} database driver.");
+ $this->markTestSkipped("This test is only relevant for database drivers that were available in Drupal prior to database drivers becoming part of modules. The {$driver} database driver is not qualifying.");
}
$filename = $this->siteDirectory . '/settings.php';
diff --git a/core/tests/Drupal/FunctionalTests/FolderTest.php b/core/tests/Drupal/FunctionalTests/FolderTest.php
index 267b59260e0..ea9cef18f9b 100644
--- a/core/tests/Drupal/FunctionalTests/FolderTest.php
+++ b/core/tests/Drupal/FunctionalTests/FolderTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests BrowserTestBase's treatment of hook_install() during setup.
*
* Image module is used for test.
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class FolderTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php
index f65c4951c0d..2fcaeb8471c 100644
--- a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php
+++ b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerExtendsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Test for BrowserTestBase::getTestMethodCaller() in child classes.
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class GetTestMethodCallerExtendsTest extends GetTestMethodCallerTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php
index 3966ebfe387..5e432156fe9 100644
--- a/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/GetTestMethodCallerTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Explicit test for BrowserTestBase::getTestMethodCaller().
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class GetTestMethodCallerTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php b/core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php
index 20145dc3711..c6a5ecca25a 100644
--- a/core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php
+++ b/core/tests/Drupal/FunctionalTests/HttpKernel/ContentLengthTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\HttpKernel;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests Content-Length set by Drupal.
- *
- * @group Http
*/
+#[Group('Http')]
class ContentLengthTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php b/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php
index bae54ab1afc..f8c9662286e 100644
--- a/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php
+++ b/core/tests/Drupal/FunctionalTests/HttpKernel/CorsIntegrationTest.php
@@ -6,6 +6,7 @@ namespace Drupal\FunctionalTests\HttpKernel;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests CORS provided by Drupal.
@@ -13,9 +14,8 @@ use Drupal\Tests\BrowserTestBase;
* @see sites/default/default.services.yml
* @see \Asm89\Stack\Cors
* @see \Asm89\Stack\CorsService
- *
- * @group Http
*/
+#[Group('Http')]
class CorsIntegrationTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/HttpKernel/DestructableServiceTest.php b/core/tests/Drupal/FunctionalTests/HttpKernel/DestructableServiceTest.php
index 317fd82cfa9..63fda6236ef 100644
--- a/core/tests/Drupal/FunctionalTests/HttpKernel/DestructableServiceTest.php
+++ b/core/tests/Drupal/FunctionalTests/HttpKernel/DestructableServiceTest.php
@@ -7,14 +7,14 @@ namespace Drupal\FunctionalTests\HttpKernel;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests invocation of services performing deferred tasks after response flush.
*
* @see \Drupal\Core\DestructableInterface
- *
- * @group Http
*/
+#[Group('Http')]
class DestructableServiceTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php
index 491ffcc6866..e0fc902f851 100644
--- a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php
+++ b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Image;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests image toolkit setup form.
- *
- * @group Image
*/
+#[Group('Image')]
class ToolkitSetupFormTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
index 79b9209e848..e15c9bb1bb4 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php
@@ -7,13 +7,13 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests distribution profile support with existing settings.
- *
- * @group Installer
*/
+#[Group('Installer')]
class DistributionProfileExistingSettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
index 76868fb17f8..566d701347b 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests distribution profile support.
- *
- * @group Installer
*/
+#[Group('Installer')]
class DistributionProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
index 764e9d15d65..204a27acab1 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests distribution profile support with a 'langcode' query string.
*
- * @group Installer
- *
* @see \Drupal\FunctionalTests\Installer\DistributionProfileTranslationTest
*/
+#[Group('Installer')]
class DistributionProfileTranslationQueryTest extends InstallerTestBase {
/**
@@ -67,7 +67,7 @@ class DistributionProfileTranslationQueryTest extends InstallerTestBase {
// profile. This distribution language should still be used.
// The unrouted URL assembler does not exist at this point, so we build the
// URL ourselves.
- $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?langcode=fr');
+ $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=fr');
}
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
index 75db313b14b..35e7a824eb6 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests distribution profile support.
*
- * @group Installer
- *
* @see \Drupal\FunctionalTests\Installer\DistributionProfileTest
*/
+#[Group('Installer')]
class DistributionProfileTranslationTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php
index 22165f456c4..380f73d70f8 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/DrupalFlushAllCachesInInstallerTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests drupal_flush_all_caches() during an install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class DrupalFlushAllCachesInInstallerTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php
index 8b2b3e727b8..421f9962574 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileDependenciesTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Extension\ModuleUninstallValidatorException;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that an install profile can require modules.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallProfileDependenciesTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileUninstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileUninstallTest.php
index 57720e6b20b..88bcf1fb50d 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallProfileUninstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallProfileUninstallTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that an install profile can be uninstalled.
- *
- * @group Extension
*/
+#[Group('Extension')]
class InstallProfileUninstallTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php
index 696a5f7a9d0..c748723bce1 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabaseCredentialsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the installer with incorrect connection info in settings.php.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerBrokenDatabaseCredentialsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php
index b766e8e6c8e..d1841b4d26a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the installer with incorrect connection info in settings.php.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerBrokenDatabasePortSettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php
index 11803c1b83c..57ce1650865 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Utility\Crypt;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests installation when a config_sync_directory is set up but does not exist.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerConfigDirectorySetNoDirectoryErrorTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
index fc01c2eb9a9..8b306a0a196 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Utility\Crypt;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the installer when a custom config directory set up but does not exist.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerConfigDirectorySetNoDirectoryTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php
index f97483dd610..94779d138d0 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerDatabaseErrorMessagesTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the installer with database errors.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerDatabaseErrorMessagesTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php
index 2ccd47a0274..7522d6fa1c7 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerEmptySettingsTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests the installer with empty settings file.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerEmptySettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php
index 879039b291c..3b6e8d0c686 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingBrokenDatabaseSettingsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the installer with broken database connection info in settings.php.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingBrokenDatabaseSettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php
index 89f7b491547..49e2e635bb3 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigDirectoryTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests installation when a config_sync_directory exists and is set up.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigDirectoryTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigExistingSettingsTest.php
index a5553bd1fb4..2d8c1d26ce7 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigExistingSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigExistingSettingsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Verifies that installing from existing configuration works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigExistingSettingsTest extends InstallerExistingConfigTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
index 8125da5bca0..4d2a5db3450 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigMultilingualTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Logger\RfcLogLevel;
+use PHPUnit\Framework\Attributes\Group;
/**
* Verifies that installing from existing configuration works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigMultilingualTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
index 4461c06b210..b8a5db5d14a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that profiles invalid config can not be installed.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigNoConfigTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoProfileTest.php
index ea4f70e3a6c..ba1bcc4edd3 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoProfileTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that installing from existing configuration without a profile works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigNoProfileTest extends InstallerExistingConfigTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
index 4022db2fcef..8bbc87e2791 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Testing installing from config without system.site.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigNoSystemSiteTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php
index 692a9af8730..800492459e0 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigProfileHookInstallTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that profiles with hook_install() can't be installed from config.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigProfileHookInstallTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
index 4d1bf067425..a158388b22d 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryMultilingualTest.php
@@ -5,14 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
// cSpell:ignore Anónimo Aplicar
-
/**
* Verifies that installing from existing configuration works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigSyncDirectoryMultilingualTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstallTest.php
index dc0cfc5c365..84bcce25c13 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstallTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that profiles with hook_install() can't be installed from config.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigSyncDirectoryProfileHookInstallTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
index 7f9a0ecf60d..5fd1e3d8ca9 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileMismatchTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that installing from existing configuration works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigSyncDirectoryProfileMismatchTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
index 487fa70ac1d..1acfdccf2b4 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTest.php
@@ -4,13 +4,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
-// cspell:ignore nmsgid nmsgstr enregistrer
+use PHPUnit\Framework\Attributes\Group;
+// cspell:ignore nmsgid nmsgstr enregistrer
/**
* Verifies that installing from existing configuration works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingConfigTest extends InstallerConfigDirectoryTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php
index 2ac3ae778a4..f7c94963754 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigTestBase.php
@@ -7,6 +7,7 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Archiver\ArchiveTar;
use Drupal\Core\Database\Database;
+use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Installer\Form\SelectProfileForm;
/**
@@ -99,8 +100,11 @@ abstract class InstallerExistingConfigTestBase extends InstallerTestBase {
// modules that can not be uninstalled in the core.extension configuration.
if (file_exists($config_sync_directory . '/core.extension.yml')) {
$core_extension = Yaml::decode(file_get_contents($config_sync_directory . '/core.extension.yml'));
- $module = Database::getConnection()->getProvider();
- if ($module !== 'core') {
+ // If the database module has dependencies, they are expected too.
+ $database_module_extension = \Drupal::service(ModuleExtensionList::class)->get(Database::getConnection()->getProvider());
+ $database_modules = $database_module_extension->requires ? array_keys($database_module_extension->requires) : [];
+ $database_modules[] = Database::getConnection()->getProvider();
+ foreach ($database_modules as $module) {
$core_extension['module'][$module] = 0;
$core_extension['module'] = module_config_sort($core_extension['module']);
}
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php
index 8717249fb67..3657826d1a0 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingDatabaseSettingsTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests installation with database information in an existing settings file.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingDatabaseSettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php
index a932da76d33..c4eeca55eca 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingInstallationTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests the installer with an existing Drupal installation.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingInstallationTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php
index 3c075895734..7249b6dace6 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsNoProfileTest.php
@@ -4,15 +4,15 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
-use Drupal\Core\DrupalKernel;
use Drupal\Core\Database\Database;
+use Drupal\Core\DrupalKernel;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests the installer with an existing settings file but no install profile.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingSettingsNoProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
index 3958b82396a..5be72fe0a9e 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingSettingsTest.php
@@ -6,13 +6,13 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests the installer with an existing settings file.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerExistingSettingsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php
index 4e401add43a..4ef3cc94ffd 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php
@@ -4,13 +4,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
-// cspell:ignore nmsgid nmsgstr
+use PHPUnit\Framework\Attributes\Group;
+// cspell:ignore nmsgid nmsgstr
/**
* Verifies that the early installer uses the correct language direction.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerLanguageDirectionTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php
index 0d12f466fda..21b47fd32bc 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php
@@ -5,14 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Language\LanguageManager;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore xoxo
-
/**
* Verifies that the installer language list uses local and remote languages.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerLanguagePageTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php
index d33d7c4942a..dcb80c6cb5f 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonDefaultDatabaseDriverTest.php
@@ -5,15 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore drupaldriver testdriverdatabasedrivertestmysql
// cspell:ignore testdriverdatabasedrivertestpgsql
-
/**
* Tests the interactive installer.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerNonDefaultDatabaseDriverTest extends InstallerTestBase {
/**
@@ -90,8 +89,8 @@ class InstallerNonDefaultDatabaseDriverTest extends InstallerTestBase {
// uninstalled being dependencies of the "driver_test" module.
$this->drupalGet('admin/modules/uninstall');
$this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-driver-test"]', "The following reason prevents Contrib database driver test from being uninstalled: The module 'Contrib database driver test' is providing the database driver '{$this->testDriverName}'.");
- $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-mysql"]', "The following reason prevents MySQL from being uninstalled: Required by: driver_test");
- $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-pgsql"]', "The following reason prevents PostgreSQL from being uninstalled: Required by: driver_test");
+ $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-mysql"]', "The following reason prevents MySQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
+ $this->assertSession()->elementTextContains('xpath', '//tr[@data-drupal-selector="edit-pgsql"]', "The following reason prevents PostgreSQL from being uninstalled: Required by: Contrib database driver test (driver_test)");
}
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php
index 5bf54301e2c..aab5e4a749a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerNonEnglishProfileWithoutLocaleModuleTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests installing a profile with non-English language and no locale module.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerNonEnglishProfileWithoutLocaleModuleTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php
index 697bf2773ac..994303dc1c8 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPerformanceTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Routing\RoutingEvents;
use Drupal\Core\Test\PerformanceTestRecorder;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the interactive installer.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerPerformanceTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php
index f527f52ece0..62606ac87aa 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerPostInstallTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests re-visiting the installer after a successful installation.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerPostInstallTest extends InstallerTestBase {
/**
@@ -31,7 +32,7 @@ class InstallerPostInstallTest extends InstallerTestBase {
// Confirm that the install_profile is correct.
$this->drupalGet('/system-test/get-install-profile');
$this->assertSession()->pageTextContains('minimal');
- // Make an anonymous visit to the installer
+ // Make an anonymous visit to the installer.
$this->drupalLogout();
$this->visitInstaller();
// Ensure that the install profile is still correct.
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php
index f2d498d8d4e..e11a5deea6e 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerProfileRequirementsTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests that an install profile can implement hook_requirements().
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerProfileRequirementsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php
index e0c70d436fc..4485729e6ef 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Routing\RoutingEvents;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Test\PerformanceTestRecorder;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests router rebuilding during installation.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerRouterTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php
index 7da75723dd4..f6b48610a41 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSiteConfigProfileTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that the installer uses the profile's site configuration.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerSiteConfigProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php
index ef2d4063370..905492e3987 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Verifies that the installer skipped permission hardening.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerSkipPermissionHardeningTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
index 4f2dc621a2c..748dac5d5e1 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
@@ -5,17 +5,16 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
+use Drupal\Core\Extension\ModuleUninstallValidatorException;
use Drupal\Core\Routing\RoutingEvents;
use Drupal\Core\Test\PerformanceTestRecorder;
-use Drupal\Core\Extension\ModuleUninstallValidatorException;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore drupalmysqldriverdatabasemysql drupalpgsqldriverdatabasepgsql
-
/**
* Tests the interactive installer.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
index c1694932a0f..f1d2d507eee 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
@@ -271,7 +271,7 @@ abstract class InstallerTestBase extends BrowserTestBase {
* Override this method to test specific requirements warnings or errors
* during the installer.
*
- * @see system_requirements()
+ * @see \Drupal\system\Install\SystemRequirements
*/
protected function setUpRequirementsProblem() {
if (version_compare(phpversion(), PhpRequirements::getMinimumSupportedPhp()) < 0) {
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php
index 116028ecd4c..fb89144d775 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerThemesBlocksProfileTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\block\Entity\Block;
+use PHPUnit\Framework\Attributes\Group;
/**
* Verifies that the installer does not generate theme blocks.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerThemesBlocksProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php
index 23633165b5c..35f480db1b1 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationExistingFileTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests translation files for multiple languages get imported during install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationExistingFileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageForeignTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageForeignTest.php
index 052ae5e01f0..1eeb3113073 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageForeignTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageForeignTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests translation files for multiple languages get imported during install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationMultipleLanguageForeignTest extends InstallerTranslationMultipleLanguageTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageKeepEnglishTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageKeepEnglishTest.php
index 3d83bf8b4ca..1f39175707e 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageKeepEnglishTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageKeepEnglishTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests that keeping English in a foreign language install works.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationMultipleLanguageKeepEnglishTest extends InstallerTranslationMultipleLanguageForeignTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
index 89039734192..1f5e80e05dd 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
@@ -6,14 +6,13 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore montag
-
/**
* Tests translation files for multiple languages get imported during install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationMultipleLanguageNonInteractiveTest extends BrowserTestBase {
use StringTranslationTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
index b7cf373a332..37db8c5e829 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests translation files for multiple languages get imported during install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationMultipleLanguageTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php
index f8be98693f5..6a0d0c2f50f 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests non-standard named translation files get imported during install.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationNonStandardFilenamesTest extends InstallerTranslationMultipleLanguageNonInteractiveTest {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
index 532c23a814e..76b237f192a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php
@@ -4,13 +4,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Installs Drupal in German and checks resulting site.
*
- * @group Installer
- *
* @see \Drupal\FunctionalTests\Installer\InstallerTranslationTest
*/
+#[Group('Installer')]
class InstallerTranslationQueryTest extends InstallerTestBase {
/**
@@ -35,7 +36,7 @@ class InstallerTranslationQueryTest extends InstallerTestBase {
// The unrouted URL assembler does not exist at this point, so we build the
// URL ourselves.
- $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?langcode=' . $this->langcode);
+ $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=' . $this->langcode);
// The language should have been automatically detected, all following
// screens should be translated already.
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
index df41e7bf510..0060152639a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Database\Database;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\Entity\User;
+use PHPUnit\Framework\Attributes\Group;
/**
* Installs Drupal in German and checks resulting site.
- *
- * @group Installer
*/
+#[Group('Installer')]
class InstallerTranslationTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php
index 3513ff168de..862d4fcffd3 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/MinimalInstallerTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\KernelTests\AssertConfigTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the interactive installer installing the minimal profile.
- *
- * @group Installer
*/
+#[Group('Installer')]
class MinimalInstallerTest extends ConfigAfterInstallerTestBase {
use AssertConfigTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
index 60dc1ffdae0..1b8f5f98775 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests multiple distribution profile support.
- *
- * @group Installer
*/
+#[Group('Installer')]
class MultipleDistributionsProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/ProfileRequirementsTest.php b/core/tests/Drupal/FunctionalTests/Installer/ProfileRequirementsTest.php
index 6a6e556944b..8b81d3f8a7c 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/ProfileRequirementsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/ProfileRequirementsTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests installing a profile that implements InstallRequirementsInterface.
- *
- * @group Installer
*/
+#[Group('Installer')]
class ProfileRequirementsTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php
index 35761c78069..9542b3a5418 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/SingleVisibleProfileTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests distribution profile support.
- *
- * @group Installer
*/
+#[Group('Installer')]
class SingleVisibleProfileTest extends InstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php
index fa513876d49..bc3d4bbe791 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that the site name can be set during a non-interactive installation.
- *
- * @group Installer
*/
+#[Group('Installer')]
class SiteNameTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php b/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php
index 404fd7c8ac2..9f802b6235f 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the extension of the site settings form.
- *
- * @group Installer
*/
+#[Group('Installer')]
class SiteSettingsFormTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
index 20714d76e9c..4edee593381 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/StandardInstallerTest.php
@@ -4,11 +4,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
+use PHPUnit\Framework\Attributes\Group;
+
/**
* Tests the interactive installer installing the standard profile.
- *
- * @group Installer
*/
+#[Group('Installer')]
class StandardInstallerTest extends ConfigAfterInstallerTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php
index 527a4326d26..b63c5d41893 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/SuperUserAccessInstallTest.php
@@ -6,12 +6,13 @@ namespace Drupal\FunctionalTests\Installer;
use Drupal\Core\Serialization\Yaml;
use Drupal\user\Entity\User;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests superuser access and the installer.
- *
- * @group Installer
*/
+#[Group('Installer')]
class SuperUserAccessInstallTest extends InstallerTestBase {
/**
@@ -70,9 +71,8 @@ class SuperUserAccessInstallTest extends InstallerTestBase {
/**
* Confirms that the installation succeeded.
- *
- * @dataProvider getInstallTests
*/
+ #[DataProvider('getInstallTests')]
public function testInstalled(bool $expected_runtime_has_permission, bool $expected_no_access_message, array $expected_roles, string $install_code, bool $super_user_policy): void {
$user = User::load(1);
$this->assertSame($expected_runtime_has_permission, $user->hasPermission('administer software updates'));
diff --git a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php
index 573f1d8c93b..28d79c572dd 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests installing the Testing profile with update notifications on.
- *
- * @group Installer
*/
+#[Group('Installer')]
class TestingProfileHooksTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php
index e58cac9ad7e..9daa074367a 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Installer;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests installing the Testing profile with update notifications on.
- *
- * @group Installer
*/
+#[Group('Installer')]
class TestingProfileInstallTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php b/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php
index 3b1c44a70a4..cd67a8b18d8 100644
--- a/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php
+++ b/core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php
@@ -5,13 +5,15 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Libraries;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
/**
* Tests the loading of jQuery UI CSS and JS assets.
- *
- * @group libraries
- * @group legacy
*/
+#[Group('libraries')]
+#[IgnoreDeprecations]
class JqueryUiLibraryAssetsTest extends BrowserTestBase {
/**
@@ -211,9 +213,8 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase {
/**
* Confirms that jQuery UI assets load on the page in the configured order.
- *
- * @dataProvider providerTestAssetLoading
*/
+ #[DataProvider('providerTestAssetLoading')]
public function testLibraryAssetLoadingOrder($library, array $expected_css, array $expected_js): void {
$this->drupalGet("jqueryui_library_assets_test/$library");
$this->assertSession()->statusCodeEquals(200);
@@ -292,9 +293,8 @@ class JqueryUiLibraryAssetsTest extends BrowserTestBase {
* The jQuery UI CSS files expected to load.
* @param string[] $expected_js
* The jQuery UI JavaScript files expected to load.
- *
- * @dataProvider providerTestAssetLoading
*/
+ #[DataProvider('providerTestAssetLoading')]
public function testAssetLoadingUnchanged($library, array $expected_css, array $expected_js): void {
$this->drupalGet("jqueryui_library_assets_test/$library");
$this->assertSession()->statusCodeEquals(200);
diff --git a/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php b/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php
index c128587612f..94909bed298 100644
--- a/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php
+++ b/core/tests/Drupal/FunctionalTests/Libraries/ManyAssetsLoadOrderTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Libraries;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the loading of many weighted assets.
- *
- * @group libraries
*/
+#[Group('libraries')]
class ManyAssetsLoadOrderTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
index bea51a83645..aac0a675a56 100644
--- a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
+++ b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
@@ -4,17 +4,17 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
-use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Test\AssertMailTrait;
+use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the collection of emails during testing.
*
* The test mail collector, test.mail.collector, intercepts any email sent
* during a test so it does not leave the test server.
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class MailCaptureTest extends BrowserTestBase {
use AssertMailTrait {
getMails as drupalGetMails;
diff --git a/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php b/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php
index 2a7e446e348..8269f607e92 100644
--- a/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php
+++ b/core/tests/Drupal/FunctionalTests/Menu/MenuActiveTrail403Test.php
@@ -7,12 +7,12 @@ namespace Drupal\FunctionalTests\Menu;
use Drupal\Core\Url;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that 403 active trail behavior does not overwrite original entry.
- *
- * @group menu
*/
+#[Group('menu')]
class MenuActiveTrail403Test extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonAnonTest.php
index 76a2cf44718..a5c144ecf1d 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Json Anon.
*/
+#[Group('rest')]
class BaseFieldOverrideJsonAnonTest extends BaseFieldOverrideResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonBasicAuthTest.php
index 4efe36b43f2..f863ae1bba9 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Json Basic Auth.
*/
+#[Group('rest')]
class BaseFieldOverrideJsonBasicAuthTest extends BaseFieldOverrideResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonCookieTest.php
index a73e780d835..5d5f57ce070 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Json Cookie.
*/
+#[Group('rest')]
class BaseFieldOverrideJsonCookieTest extends BaseFieldOverrideResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlAnonTest.php
index 44c6a021b14..7456bfad828 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Xml Anon.
*/
+#[Group('rest')]
class BaseFieldOverrideXmlAnonTest extends BaseFieldOverrideResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlBasicAuthTest.php
index f651db1657d..e40d7088c95 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Xml Basic Auth.
*/
+#[Group('rest')]
class BaseFieldOverrideXmlBasicAuthTest extends BaseFieldOverrideResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlCookieTest.php
index acdede9bfa4..eedb7ee8d2e 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Base Field Override Xml Cookie.
*/
+#[Group('rest')]
class BaseFieldOverrideXmlCookieTest extends BaseFieldOverrideResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php
index 68ba252688f..bbad8779e7c 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Json Anon.
*/
+#[Group('rest')]
class DateFormatJsonAnonTest extends DateFormatResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php
index ecdc84cfd19..62962d4761d 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Json Basic Auth.
*/
+#[Group('rest')]
class DateFormatJsonBasicAuthTest extends DateFormatResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php
index 4067f678cc3..422ec9f644e 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Json Cookie.
*/
+#[Group('rest')]
class DateFormatJsonCookieTest extends DateFormatResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php
index d0e1c012ca2..6681bb1d3f4 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Xml Anon.
*/
+#[Group('rest')]
class DateFormatXmlAnonTest extends DateFormatResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php
index 7eee1133be8..ccd0ceeaad3 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Xml Basic Auth.
*/
+#[Group('rest')]
class DateFormatXmlBasicAuthTest extends DateFormatResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php
index 30eb2af68e5..5780d879d93 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/DateFormatXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Date Format Xml Cookie.
*/
+#[Group('rest')]
class DateFormatXmlCookieTest extends DateFormatResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonAnonTest.php
index 3b5cc13f9d1..971aff5ad1c 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Json Anon.
*/
+#[Group('rest')]
class EntityFormDisplayJsonAnonTest extends EntityFormDisplayResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonBasicAuthTest.php
index 432c097d00d..5ee82893c8a 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Json Basic Auth.
*/
+#[Group('rest')]
class EntityFormDisplayJsonBasicAuthTest extends EntityFormDisplayResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonCookieTest.php
index 3ec1cb8f33a..15c4fbbbb1e 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Json Cookie.
*/
+#[Group('rest')]
class EntityFormDisplayJsonCookieTest extends EntityFormDisplayResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlAnonTest.php
index 695905aeae4..d466df9f7d8 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Xml Anon.
*/
+#[Group('rest')]
class EntityFormDisplayXmlAnonTest extends EntityFormDisplayResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlBasicAuthTest.php
index 2941b421968..62f4618eb96 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Xml Basic Auth.
*/
+#[Group('rest')]
class EntityFormDisplayXmlBasicAuthTest extends EntityFormDisplayResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlCookieTest.php
index 915bb21fb2d..d697e579fa3 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Display Xml Cookie.
*/
+#[Group('rest')]
class EntityFormDisplayXmlCookieTest extends EntityFormDisplayResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonAnonTest.php
index 9f97c320d78..49883366571 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Json Anon.
*/
+#[Group('rest')]
class EntityFormModeJsonAnonTest extends EntityFormModeResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonBasicAuthTest.php
index bbdff334404..2a0a06c68ef 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Json Basic Auth.
*/
+#[Group('rest')]
class EntityFormModeJsonBasicAuthTest extends EntityFormModeResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonCookieTest.php
index da6f959e691..e67266ed505 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Json Cookie.
*/
+#[Group('rest')]
class EntityFormModeJsonCookieTest extends EntityFormModeResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlAnonTest.php
index bd1ccb0809e..ebf94121b63 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Xml Anon.
*/
+#[Group('rest')]
class EntityFormModeXmlAnonTest extends EntityFormModeResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlBasicAuthTest.php
index 10d773ee3a1..073fafca7dc 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Xml Basic Auth.
*/
+#[Group('rest')]
class EntityFormModeXmlBasicAuthTest extends EntityFormModeResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlCookieTest.php
index 84e96a2d783..0378795ddcd 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity Form Mode Xml Cookie.
*/
+#[Group('rest')]
class EntityFormModeXmlCookieTest extends EntityFormModeResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonAnonTest.php
index ab1be70ceb8..34a40b67264 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Json Anon.
*/
+#[Group('rest')]
class EntityViewDisplayJsonAnonTest extends EntityViewDisplayResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonBasicAuthTest.php
index 8c0f05b4d59..50d1eddeddb 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Json Basic Auth.
*/
+#[Group('rest')]
class EntityViewDisplayJsonBasicAuthTest extends EntityViewDisplayResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonCookieTest.php
index ef4704da0b2..565b02fac5f 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Json Cookie.
*/
+#[Group('rest')]
class EntityViewDisplayJsonCookieTest extends EntityViewDisplayResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlAnonTest.php
index d4f0cfe61c6..298e9f86364 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Xml Anon.
*/
+#[Group('rest')]
class EntityViewDisplayXmlAnonTest extends EntityViewDisplayResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlBasicAuthTest.php
index 09697cbe9f2..36b3d0c19f1 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Xml Basic Auth.
*/
+#[Group('rest')]
class EntityViewDisplayXmlBasicAuthTest extends EntityViewDisplayResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlCookieTest.php
index c1ef24fe5a3..d2ee3036c9d 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Display Xml Cookie.
*/
+#[Group('rest')]
class EntityViewDisplayXmlCookieTest extends EntityViewDisplayResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonAnonTest.php
index 7cd8de33e10..16eec966d9a 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonAnonTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Json Anon.
*/
+#[Group('rest')]
class EntityViewModeJsonAnonTest extends EntityViewModeResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonBasicAuthTest.php
index 8d41d2e7b19..b61d4482305 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonBasicAuthTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Json Basic Auth.
*/
+#[Group('rest')]
class EntityViewModeJsonBasicAuthTest extends EntityViewModeResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonCookieTest.php
index fe7c0fda9c7..e260cea160a 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeJsonCookieTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Json Cookie.
*/
+#[Group('rest')]
class EntityViewModeJsonCookieTest extends EntityViewModeResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlAnonTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlAnonTest.php
index 5a45858f4b0..6bfd9376075 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlAnonTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlAnonTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Xml Anon.
*/
+#[Group('rest')]
class EntityViewModeXmlAnonTest extends EntityViewModeResourceTestBase {
use AnonResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlBasicAuthTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlBasicAuthTest.php
index 53b287186de..de37e554fd6 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlBasicAuthTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlBasicAuthTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Xml Basic Auth.
*/
+#[Group('rest')]
class EntityViewModeXmlBasicAuthTest extends EntityViewModeResourceTestBase {
use BasicAuthResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php
index bbd6438dbcc..1d38cbf8fa9 100644
--- a/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php
+++ b/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php
@@ -6,10 +6,12 @@ namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\XmlEntityNormalizationQuirksTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group rest
+ * Tests Entity View Mode Xml Cookie.
*/
+#[Group('rest')]
class EntityViewModeXmlCookieTest extends EntityViewModeResourceTestBase {
use CookieResourceTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php
index 447224e931f..9f591c70697 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/CaseInsensitivePathTest.php
@@ -5,14 +5,13 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
// cspell:ignore ȅchȏ foobarbaz meΦω
-
/**
* Tests incoming path case insensitivity.
- *
- * @group routing
*/
+#[Group('routing')]
class CaseInsensitivePathTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php b/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php
index 734058c0c4e..c8c91d9fd91 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group routing
+ * Tests Default Format.
*/
+#[Group('routing')]
class DefaultFormatTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php b/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php
index e344c7d4190..220722dab39 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/LazyRouteProviderInstallTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
- * @group routing
+ * Tests Lazy Route Provider Install.
*/
+#[Group('routing')]
class LazyRouteProviderInstallTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
index 0ac2339a810..3b398a2dfd6 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
@@ -7,13 +7,13 @@ namespace Drupal\FunctionalTests\Routing;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\PathAliasTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests URL generation and routing for route paths with encoded characters.
- *
- * @group path
- * @group routing
*/
+#[Group('path')]
+#[Group('routing')]
class PathEncodedTest extends BrowserTestBase {
use PathAliasTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php
index 9e4d9485d8a..8344dd31be4 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingLanguageTest.php
@@ -10,12 +10,13 @@ use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\link\LinkItemInterface;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that route lookup is cached by the current language.
- *
- * @group routing
*/
+#[Group('routing')]
class RouteCachingLanguageTest extends BrowserTestBase {
use ContentTranslationTestTrait;
@@ -124,9 +125,8 @@ class RouteCachingLanguageTest extends BrowserTestBase {
/**
* Creates content with a link field pointing to an alias of another language.
- *
- * @dataProvider providerLanguage
*/
+ #[DataProvider('providerLanguage')]
public function testLinkTranslationWithAlias($source_langcode): void {
$source_url_options = [
'language' => ConfigurableLanguage::load($source_langcode),
diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php
index 513c22142d5..a88785f3964 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingNonPathLanguageNegotiationTest.php
@@ -4,16 +4,16 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
-use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Core\Language\LanguageInterface;
+use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\Traits\Core\PathAliasTestTrait;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the route cache when the language is not in the path.
- *
- * @group language
*/
+#[Group('language')]
class RouteCachingNonPathLanguageNegotiationTest extends BrowserTestBase {
use PathAliasTestTrait;
diff --git a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php
index 3e099fa46fc..67655e54eee 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/RouteCachingQueryAlteredTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Routing;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\HttpFoundation\Response;
/**
@@ -12,9 +13,8 @@ use Symfony\Component\HttpFoundation\Response;
*
* This happens either in the normal course of operations or due to an
* exception.
- *
- * @group routing
*/
+#[Group('routing')]
class RouteCachingQueryAlteredTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php
index 8bb18f2c059..3873fd2d3d1 100644
--- a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php
+++ b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputHelperTest.php
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Test;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Helper test for FunctionalTestDebugHtmlOutputTest.
*
* @see \Drupal\FunctionalTests\Test\FunctionalTestDebugHtmlOutputTest::testFunctionalTestDebugHtmlOutput
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class FunctionalTestDebugHtmlOutputHelperTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php
index 64c19772140..945cf12430b 100644
--- a/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php
+++ b/core/tests/Drupal/FunctionalTests/Test/FunctionalTestDebugHtmlOutputTest.php
@@ -6,14 +6,14 @@ namespace Drupal\FunctionalTests\Test;
use Drupal\Core\File\FileExists;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
use Symfony\Component\Process\Process;
/**
* Test to ensure that functional tests produce debug HTML output when required.
- *
- * @group browsertestbase
- * @group #slow
*/
+#[Group('browsertestbase')]
+#[Group('#slow')]
class FunctionalTestDebugHtmlOutputTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php b/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php
index 99e4974e3fc..fca57abec9d 100644
--- a/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php
+++ b/core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Theme;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the layout builder with the Claro theme.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroLayoutBuilderTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php b/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php
index b38938f3138..973feb8d05b 100644
--- a/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php
+++ b/core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Theme;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the Claro theme.
- *
- * @group claro
*/
+#[Group('claro')]
class ClaroTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php b/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php
index dc03f86a963..c37c694b06f 100644
--- a/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php
+++ b/core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php
@@ -4,14 +4,14 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests\Theme;
-use Drupal\Tests\BrowserTestBase;
use Drupal\menu_link_content\Entity\MenuLinkContent;
+use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the Olivero theme.
- *
- * @group olivero
*/
+#[Group('olivero')]
class OliveroTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
index 8b2c4b493e4..3ee78e55365 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
@@ -137,6 +137,16 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
// Load the database(s).
foreach ($this->databaseDumpFiles as $file) {
+ // Determine the version of the database dump if specified.
+ $matches = [];
+ $dumpVersion = preg_match('/drupal-(\d+\.\d+\.\d+)\./', $file, $matches) === 1 ? $matches[1] : NULL;
+
+ // If the db driver is mysqli, we do not need to run the update tests for
+ // db dumps prior to 11.2 when the module was introduced.
+ if (Database::getConnection()->getProvider() === 'mysqli' && $dumpVersion && version_compare($dumpVersion, '11.2.0', '<')) {
+ $this->markTestSkipped("The mysqli driver was introduced in Drupal 11.2, skip update tests from database at version {$dumpVersion}");
+ }
+
if (str_ends_with($file, '.gz')) {
$file = "compress.zlib://$file";
}
diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php
index b8c5dbde1ee..f02ecdfba47 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBaseTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Update;
use Drupal\Core\Database\Database;
use Drupal\Core\Site\Settings;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests the update path base class.
- *
- * @group Update
*/
+#[Group('Update')]
class UpdatePathTestBaseTest extends UpdatePathTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdateReducedThemeRegistryTest.php b/core/tests/Drupal/FunctionalTests/Update/UpdateReducedThemeRegistryTest.php
index b31d62cc3d0..ba2cc5ee18f 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdateReducedThemeRegistryTest.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdateReducedThemeRegistryTest.php
@@ -6,12 +6,12 @@ namespace Drupal\FunctionalTests\Update;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests that update.php is accessible even if there are unstable modules.
- *
- * @group Update
*/
+#[Group('Update')]
class UpdateReducedThemeRegistryTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/FunctionalTests/UserHelpersTest.php b/core/tests/Drupal/FunctionalTests/UserHelpersTest.php
index 151a0827246..a5cac6dc418 100644
--- a/core/tests/Drupal/FunctionalTests/UserHelpersTest.php
+++ b/core/tests/Drupal/FunctionalTests/UserHelpersTest.php
@@ -5,12 +5,12 @@ declare(strict_types=1);
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
+use PHPUnit\Framework\Attributes\Group;
/**
* Tests User related helper methods of BrowserTestBase.
- *
- * @group browsertestbase
*/
+#[Group('browsertestbase')]
class UserHelpersTest extends BrowserTestBase {
/**
diff --git a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php
index f375f6f3dd6..20f21373046 100644
--- a/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php
+++ b/core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php
@@ -100,7 +100,6 @@ class MappingTest extends KernelTestBase {
// Avoid showing "Powered by Drupal" on 404 responses.
'visibility' => [
'I_CAN_CHOOSE_THIS' => [
- // This is what determines the
'id' => 'response_status',
'negate' => FALSE,
'status_codes' => [
@@ -219,7 +218,7 @@ class MappingTest extends KernelTestBase {
// Special case: deprecated is needed for deprecated config schema:
// - deprecated keys are treated as optional
// - if a deprecated property path is itself a mapping, then the keys inside
- // are not optional
+ // are not optional.
yield 'No dynamic type: config_schema_deprecated_test.settings' => [
'config_schema_deprecated_test.settings',
NULL,
diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
index 6dd535e88f9..809e54737b7 100644
--- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
@@ -467,4 +467,26 @@ class AttachedAssetsTest extends KernelTestBase {
$this->assertStringContainsString('<script src="' . str_replace('&', '&amp;', $this->fileUrlGenerator->generateString('core/modules/system/tests/modules/common_test/querystring.js?arg1=value1&arg2=value2')) . '&amp;' . $query_string . '"></script>', $rendered_js, 'JavaScript file with query string gets version query string correctly appended.');
}
+ /**
+ * Test settings can be loaded even when libraries are not.
+ */
+ public function testAttachedSettingsWithoutLibraries(): void {
+ $assets = new AttachedAssets();
+
+ // First test with no libraries will return no settings.
+ $assets->setSettings(['test' => 'foo']);
+ $js = $this->assetResolver->getJsAssets($assets, TRUE, \Drupal::languageManager()->getCurrentLanguage())[1];
+ $this->assertArrayNotHasKey('drupalSettings', $js);
+
+ // Second test with a warm cache.
+ $js = $this->assetResolver->getJsAssets($assets, TRUE, \Drupal::languageManager()->getCurrentLanguage())[1];
+ $this->assertArrayNotHasKey('drupalSettings', $js);
+
+ // Now test with different settings when drupalSettings is already loaded.
+ $assets->setSettings(['test' => 'bar']);
+ $assets->setAlreadyLoadedLibraries(['core/drupalSettings']);
+ $js = $this->assetResolver->getJsAssets($assets, TRUE, \Drupal::languageManager()->getCurrentLanguage())[1];
+ $this->assertSame('bar', $js['drupalSettings']['data']['test']);
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
index bbebfcf7ab4..00698b22a27 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
@@ -48,7 +48,7 @@ class ConfigDiffTest extends KernelTestBase {
[$change_key . ': ' . $original_data[$change_key]],
[$change_key . ': ' . $change_data]);
- // Reset data back to original, and remove a key
+ // Reset data back to original, and remove a key.
$sync_data = $original_data;
unset($sync_data[$remove_key]);
$sync->write($config_name, $sync_data);
@@ -62,7 +62,7 @@ class ConfigDiffTest extends KernelTestBase {
FALSE
);
- // Reset data back to original and add a key
+ // Reset data back to original and add a key.
$sync_data = $original_data;
$sync_data[$add_key] = $add_data;
$sync->write($config_name, $sync_data);
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigExistsConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigExistsConstraintValidatorTest.php
index bcdc76cc71d..3d3ee862cef 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigExistsConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigExistsConstraintValidatorTest.php
@@ -28,6 +28,7 @@ class ConfigExistsConstraintValidatorTest extends KernelTestBase {
*
* @testWith [{}, "system.site", "system.site"]
* [{"prefix": "system."}, "site", "system.site"]
+ * [{"prefix": "system.[%parent.reference]."}, "admin", "system.menu.admin"]
*/
public function testValidation(array $constraint_options, string $value, string $expected_config_name): void {
// Create a data definition that specifies the value must be a string with
@@ -37,7 +38,11 @@ class ConfigExistsConstraintValidatorTest extends KernelTestBase {
/** @var \Drupal\Core\TypedData\TypedDataManagerInterface $typed_data */
$typed_data = $this->container->get('typed_data_manager');
- $data = $typed_data->create($definition, $value);
+
+ // Create a data definition for the parent data.
+ $parent_data_definition = $typed_data->createDataDefinition('map');
+ $parent_data = $typed_data->create($parent_data_definition, ['reference' => 'menu']);
+ $data = $typed_data->create($definition, $value, 'data_name', $parent_data);
$violations = $data->validate();
$this->assertCount(1, $violations);
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
index 4cd56888088..dcdc149c86a 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
@@ -459,9 +459,13 @@ class ConfigSchemaTest extends KernelTestBase {
];
// Save config which has a schema that enforces types.
- $this->config('config_schema_test.schema_data_types')
+ $config_object = $this->config('config_schema_test.schema_data_types');
+ $config_object
->setData($untyped_to_typed)
->save();
+ // Ensure the schemaWrapper property is reset after saving to prevent a
+ // memory leak.
+ $this->assertNull((new \ReflectionObject($config_object))->getProperty('schemaWrapper')->getValue($config_object));
$this->assertSame($typed_values, $this->config('config_schema_test.schema_data_types')->get());
// Save config which does not have a schema that enforces types.
diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
index 8eb71360bd3..ce38b4a5682 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
@@ -83,7 +83,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from exists()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -91,7 +91,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from read()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -99,7 +99,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from readMultiple()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -107,7 +107,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from deleteAll()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -115,7 +115,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from listAll()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -123,7 +123,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from deleteAll()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
try {
@@ -131,7 +131,7 @@ class DatabaseStorageTest extends ConfigStorageTestBase {
$this->fail('Expected exception not thrown from getAllCollectionNames()');
}
catch (DatabaseExceptionWrapper) {
- // Exception was expected
+ // Exception was expected.
}
$this->assertTrue(TRUE);
diff --git a/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php b/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php
index 91cc24234e1..9882d3d9ef0 100644
--- a/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Controller/ControllerBaseTest.php
@@ -4,8 +4,10 @@ declare(strict_types=1);
namespace Drupal\KernelTests\Core\Controller;
+use Drupal\dblog\Logger\DbLog;
use Drupal\KernelTests\KernelTestBase;
use Drupal\system_test\Controller\BrokenSystemTestController;
+use Drupal\system_test\Controller\OptionalServiceSystemTestController;
use Drupal\system_test\Controller\SystemTestController;
use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException;
@@ -52,4 +54,17 @@ class ControllerBaseTest extends KernelTestBase {
$this->container->get('class_resolver')->getInstanceFromDefinition(BrokenSystemTestController::class);
}
+ /**
+ * @covers ::create
+ */
+ public function testCreateOptional(): void {
+ $service = $this->container->get('class_resolver')->getInstanceFromDefinition(OptionalServiceSystemTestController::class);
+ $this->assertInstanceOf(OptionalServiceSystemTestController::class, $service);
+ $this->assertNull($service->dbLog);
+ $this->container->get('module_installer')->install(['dblog']);
+ $service = $this->container->get('class_resolver')->getInstanceFromDefinition(OptionalServiceSystemTestController::class);
+ $this->assertInstanceOf(OptionalServiceSystemTestController::class, $service);
+ $this->assertInstanceOf(DbLog::class, $service->dbLog);
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php
index 079009dc7a5..8725f647e8d 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php
@@ -63,18 +63,6 @@ class BasicSyntaxTest extends DatabaseTestBase {
}
/**
- * Tests string concatenation with separator, with field values.
- */
- public function testConcatWsFields(): void {
- $result = $this->connection->query("SELECT CONCAT_WS('-', :a1, [name], :a2, [age]) FROM {test} WHERE [age] = :age", [
- ':a1' => 'name',
- ':a2' => 'age',
- ':age' => 25,
- ]);
- $this->assertSame('name-John-age-25', $result->fetchField());
- }
-
- /**
* Tests escaping of LIKE wildcards.
*/
public function testLikeEscape(): void {
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
index ca5fb32936b..07db421d76d 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.php
@@ -272,6 +272,16 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase
// Test the primary key columns.
$this->assertSame(['test_serial', 'test_composite_primary_key'], $method->invoke($this->schema, 'test_table'));
+ // Test adding and removing JSON column.
+ $this->schema->addField('test_table', 'test_json', [
+ 'description' => 'I heard you liked JSON.',
+ 'type' => 'json',
+ 'pgsql_type' => 'jsonb',
+ 'mysql_type' => 'json',
+ 'sqlite_type' => 'json',
+ ]);
+ $this->schema->dropField('test_table', 'test_json');
+
// Test renaming of keys and constraints.
$this->schema->dropTable('test_table');
$table_specification = [
@@ -1282,7 +1292,7 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase
$this->assertFalse($this->schema->fieldExists($table_name_new, $field_name));
$this->assertTrue($this->schema->fieldExists($table_name_new, $field_name_new));
- // Adding an unique key
+ // Adding an unique key.
$unique_key_name = $unique_key_introspect_name = 'unique';
$this->schema->addUniqueKey($table_name_new, $unique_key_name, [$field_name_new]);
@@ -1290,7 +1300,7 @@ abstract class DriverSpecificSchemaTestBase extends DriverSpecificKernelTestBase
$introspect_index_schema = new \ReflectionMethod(get_class($this->schema), 'introspectIndexSchema');
$this->assertEquals([$field_name_new], $introspect_index_schema->invoke($this->schema, $table_name_new)['unique keys'][$unique_key_introspect_name]);
- // Dropping an unique key
+ // Dropping an unique key.
$this->schema->dropUniqueKey($table_name_new, $unique_key_name);
// Dropping a field.
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php
index 7723d872cc1..e1833620539 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSyntaxTestBase.php
@@ -43,4 +43,16 @@ abstract class DriverSpecificSyntaxTestBase extends DriverSpecificDatabaseTestBa
$this->assertSame('[square]', $result->fetchField());
}
+ /**
+ * Tests string concatenation with separator, with field values.
+ */
+ public function testConcatWsFields(): void {
+ $result = $this->connection->query("SELECT CONCAT_WS('-', :a1, [name], :a2, [age]) FROM {test} WHERE [age] = :age", [
+ ':a1' => 'name',
+ ':a2' => 'age',
+ ':age' => 25,
+ ]);
+ $this->assertSame('name-John-age-25', $result->fetchField());
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
index cbda6e3d7f7..b7e31e06a59 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php
@@ -38,7 +38,7 @@ use Drupal\Core\Database\TransactionOutOfOrderException;
* is active, and mysqli does not fail when rolling back and no transaction
* active.
*/
-class DriverSpecificTransactionTestBase extends DriverSpecificDatabaseTestBase {
+abstract class DriverSpecificTransactionTestBase extends DriverSpecificDatabaseTestBase {
/**
* Keeps track of the post-transaction callback action executed.
diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php
index 2a0f685d2ac..6f6571fa6b0 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php
@@ -168,7 +168,7 @@ class InsertTest extends DatabaseTestBase {
// INSERT INTO test (age, name, job)
// SELECT tp.age AS age, tp.name AS name, tp.job AS job
// FROM test_people tp
- // WHERE tp.name = 'Meredith'
+ // WHERE tp.name = 'Meredith'.
$this->connection->insert('test')
->from($query)
->execute();
@@ -189,7 +189,7 @@ class InsertTest extends DatabaseTestBase {
// INSERT INTO test_people_copy
// SELECT *
// FROM test_people tp
- // WHERE tp.name = 'Meredith'
+ // WHERE tp.name = 'Meredith'.
$this->connection->insert('test_people_copy')
->from($query)
->execute();
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php
index 15364ad53af..8dcefa33f43 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SelectCloneTest.php
@@ -35,7 +35,7 @@ class SelectCloneTest extends DatabaseTestBase {
$clone_result = $clone->countQuery()->execute()->fetchField();
$query_result = $query->countQuery()->execute()->fetchField();
- // Make sure the cloned query has not been modified
+ // Make sure the cloned query has not been modified.
$this->assertEquals(3, $clone_result, 'The cloned query returns the expected number of rows');
$this->assertEquals(2, $query_result, 'The query returns the expected number of rows');
}
diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php
new file mode 100644
index 00000000000..78f87858c37
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Datetime/DrupalDateTimeTest.php
@@ -0,0 +1,109 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\KernelTests\Core\Datetime;
+
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\Tests\user\Traits\UserCreationTrait;
+
+/**
+ * Tests DrupalDateTime functionality.
+ *
+ * @group Datetime
+ */
+class DrupalDateTimeTest extends KernelTestBase {
+
+ use UserCreationTrait;
+
+ /**
+ * Set up required modules.
+ *
+ * @var string[]
+ */
+ protected static $modules = [
+ 'system',
+ 'user',
+ ];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+ $this->installConfig(['system']);
+ $this->installEntitySchema('user');
+ }
+
+ /**
+ * Tests that DrupalDateTime can detect the right timezone to use.
+ *
+ * Test with a variety of less commonly used timezone names to
+ * help ensure that the system timezone will be different than the
+ * stated timezones.
+ */
+ public function testDateTimezone(): void {
+ $date_string = '2007-01-31 21:00:00';
+
+ // Make sure no site timezone has been set.
+ $this->config('system.date')
+ ->set('timezone.user.configurable', 0)
+ ->set('timezone.default', NULL)
+ ->save();
+
+ // Detect the system timezone.
+ $system_timezone = date_default_timezone_get();
+
+ // Create a date object with an unspecified timezone, which should
+ // end up using the system timezone.
+ $date = new DrupalDateTime($date_string);
+ $timezone = $date->getTimezone()->getName();
+ $this->assertSame($system_timezone, $timezone, 'DrupalDateTime uses the system timezone when there is no site timezone.');
+
+ // Create a date object with a specified timezone.
+ $date = new DrupalDateTime($date_string, 'America/Yellowknife');
+ $timezone = $date->getTimezone()->getName();
+ $this->assertSame('America/Yellowknife', $timezone, 'DrupalDateTime uses the specified timezone if provided.');
+
+ // Set a site timezone.
+ $this->config('system.date')->set('timezone.default', 'Europe/Warsaw')->save();
+
+ // Create a date object with an unspecified timezone, which should
+ // end up using the site timezone.
+ $date = new DrupalDateTime($date_string);
+ $timezone = $date->getTimezone()->getName();
+ $this->assertSame('Europe/Warsaw', $timezone, 'DrupalDateTime uses the site timezone if provided.');
+
+ // Create user.
+ $this->config('system.date')->set('timezone.user.configurable', 1)->save();
+ $this->setUpCurrentUser([
+ 'timezone' => 'Asia/Manila',
+ ]);
+
+ // Create a date object with an unspecified timezone, which should
+ // end up using the user timezone.
+ $date = new DrupalDateTime($date_string);
+ $timezone = $date->getTimezone()->getName();
+ $this->assertSame('Asia/Manila', $timezone, 'DrupalDateTime uses the user timezone, if configurable timezones are used and it is set.');
+ }
+
+ /**
+ * Tests the ability to override the time zone in the format method.
+ */
+ public function testTimezoneFormat(): void {
+ // Create a date in UTC.
+ $date = DrupalDateTime::createFromTimestamp(87654321, 'UTC');
+
+ // Verify that the date format method displays the default time zone.
+ $this->assertEquals('1972/10/11 12:25:21 UTC', $date->format('Y/m/d H:i:s e'), 'Date has default UTC time zone and correct date/time.');
+
+ // Verify that the format method can override the time zone.
+ $this->assertEquals('1972/10/11 08:25:21 America/New_York', $date->format('Y/m/d H:i:s e', ['timezone' => 'America/New_York']), 'Date displayed overridden time zone and correct date/time');
+
+ // Verify that the date format method still displays the default time zone
+ // for the date object.
+ $this->assertEquals('1972/10/11 12:25:21 UTC', $date->format('Y/m/d H:i:s e'), 'Date still has default UTC time zone and correct date/time');
+ }
+
+}
diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
index 3be9b023b2f..bc6368dadc7 100644
--- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php
@@ -7,7 +7,6 @@ namespace Drupal\KernelTests\Core\DrupalKernel;
use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\DrupalKernelInterface;
-use Drupal\Core\Utility\Error;
use Drupal\KernelTests\KernelTestBase;
use org\bovigo\vfs\vfsStream;
use Prophecy\Argument;
@@ -27,8 +26,7 @@ class DrupalKernelTest extends KernelTestBase {
* {@inheritdoc}
*/
protected function tearDown(): void {
- $currentErrorHandler = Error::currentErrorHandler();
- if (is_string($currentErrorHandler) && $currentErrorHandler === '_drupal_error_handler') {
+ if (get_error_handler() === '_drupal_error_handler') {
restore_error_handler();
}
parent::tearDown();
@@ -250,7 +248,7 @@ class DrupalKernelTest extends KernelTestBase {
$classloader = $this->prophesize(ClassLoader::class);
// Assert that we call the setApcuPrefix on the classloader if
- // class_loader_auto_detect is set to TRUE;
+ // class_loader_auto_detect is set to TRUE.
if ($value) {
$classloader->setApcuPrefix(Argument::type('string'))->shouldBeCalled();
}
diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
index 76e6d2d9532..b54b3065955 100644
--- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php
@@ -28,7 +28,7 @@ class ServiceDestructionTest extends KernelTestBase {
// The service has not been destructed yet.
$this->assertNull(\Drupal::state()->get('service_provider_test.destructed'));
- // Call the class and then terminate the kernel
+ // Call the class and then terminate the kernel.
$this->container->get('service_provider_test_class');
$response = new Response();
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php
index f8c9848bfcf..9820f7f05d5 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php
@@ -42,7 +42,7 @@ class ConfigEntityAdapterTest extends KernelTestBase {
$this->installConfig(static::$modules);
// ConfigTest::create doesn't work with the following exception:
- // "Multiple entity types found for Drupal\config_test\Entity\ConfigTest."
+ // "Multiple entity types found for Drupal\config_test\Entity\ConfigTest".
$this->entity = \Drupal::entityTypeManager()->getStorage('config_test')->create([
'id' => 'system',
'label' => 'foobar',
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
index 4dac0039460..2269e9151d5 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
@@ -551,28 +551,28 @@ class ConfigEntityQueryTest extends KernelTestBase {
];
// Sort key: id
- // Sorting with 'DESC' upper case
+ // Sorting with 'DESC' upper case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('id', 'DESC')
->execute();
$this->assertSame(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults));
- // Sorting with 'ASC' upper case
+ // Sorting with 'ASC' upper case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('id', 'ASC')
->execute();
$this->assertSame(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults));
- // Sorting with 'desc' lower case
+ // Sorting with 'desc' lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('id', 'desc')
->execute();
$this->assertSame(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults));
- // Sorting with 'asc' lower case
+ // Sorting with 'asc' lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('id', 'asc')
@@ -580,28 +580,28 @@ class ConfigEntityQueryTest extends KernelTestBase {
$this->assertSame(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults));
// Sort key: number
- // Sorting with 'DeSc' mixed upper and lower case
+ // Sorting with 'DeSc' mixed upper and lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('number', 'DeSc')
->execute();
$this->assertSame(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults));
- // Sorting with 'AsC' mixed upper and lower case
+ // Sorting with 'AsC' mixed upper and lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('number', 'AsC')
->execute();
$this->assertSame(['6', '4', '1', '2', '5', '3', '7'], array_values($this->queryResults));
- // Sorting with 'dEsC' mixed upper and lower case
+ // Sorting with 'dEsC' mixed upper and lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('number', 'dEsC')
->execute();
$this->assertSame(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults));
- // Sorting with 'aSc' mixed upper and lower case
+ // Sorting with 'aSc' mixed upper and lower case.
$this->queryResults = $this->entityStorage->getQuery()
->tableSort($header)
->sort('number', 'aSc')
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
index bd7ec5c89c7..7beb22610fb 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
@@ -296,7 +296,7 @@ class EntityAutocompleteElementFormTest extends EntityKernelTestBase implements
public function testInvalidEntityAutocompleteElement(): void {
$form_builder = $this->container->get('form_builder');
- // Test 'single' with an entity label that doesn't exist
+ // Test 'single' with an entity label that doesn't exist.
$form_state = (new FormState())
->setValues([
'single' => 'single - non-existent label',
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php
new file mode 100644
index 00000000000..419d8bff4d4
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityBundleEntityTest.php
@@ -0,0 +1,85 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\KernelTests\Core\Entity;
+
+use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_test\Entity\EntityTestBundle;
+use Drupal\entity_test\Entity\EntityTestNoBundleWithLabel;
+use Drupal\entity_test\Entity\EntityTestWithBundle;
+
+/**
+ * Tests the getBundleEntity() method.
+ *
+ * @coversDefaultClass \Drupal\Core\Entity\ContentEntityBase
+ *
+ * @group Entity
+ */
+class EntityBundleEntityTest extends EntityKernelTestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static $modules = ['entity_test'];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->installEntitySchema('entity_test');
+ $this->installEntitySchema('entity_test_with_bundle');
+ $this->installEntitySchema('entity_test_no_bundle_with_label');
+ }
+
+ /**
+ * Tests an entity type with config entities for bundles.
+ *
+ * @covers ::getBundleEntity
+ */
+ public function testWithConfigBundleEntity(): void {
+ $bundleEntity = EntityTestBundle::create([
+ 'id' => 'bundle_alpha',
+ 'label' => 'Alpha',
+ ]);
+ $bundleEntity->save();
+
+ $entity = EntityTestWithBundle::create([
+ 'type' => 'bundle_alpha',
+ 'name' => 'foo',
+ ]);
+ $entity->save();
+ $this->assertEquals($bundleEntity->id(), $entity->getBundleEntity()->id());
+ }
+
+ /**
+ * Tests an entity type without config entities for bundles.
+ *
+ * EntityTest doesn't have bundles, but does have the bundle entity key.
+ *
+ * @covers ::getBundleEntity
+ */
+ public function testWithoutBundleEntity(): void {
+ $entity = EntityTest::create([
+ 'name' => 'foo',
+ ]);
+ $entity->save();
+ $this->assertNull($entity->getBundleEntity());
+ }
+
+ /**
+ * Tests an entity type without the bundle entity key.
+ *
+ * @covers ::getBundleEntity
+ */
+ public function testWithBundleKeyEntity(): void {
+ $entity = EntityTestNoBundleWithLabel::create([
+ 'name' => 'foo',
+ ]);
+ $entity->save();
+ $this->assertNull($entity->getBundleEntity());
+ }
+
+}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php
index 5e708fbbc2f..a914752e9f1 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateMultipleTypesTest.php
@@ -774,7 +774,7 @@ class EntityDefinitionUpdateMultipleTypesTest extends EntityKernelTestBase {
$this->assertTrue($this->database->schema()->fieldExists('entity_test_update', 'new_base_field'), "New field 'new_base_field' has been created on the 'entity_test_update' table.");
$this->assertTrue($this->database->schema()->indexExists('entity_test_update', 'entity_test_update_field__new_base_field'), "New index 'entity_test_update_field__new_base_field' has been created on the 'entity_test_update' table.");
// Check index size in for MySQL.
- if (Database::getConnection()->driver() == 'mysql') {
+ if (in_array(Database::getConnection()->driver(), ['mysql', 'mysqli'])) {
$result = Database::getConnection()->query('SHOW INDEX FROM {entity_test_update} WHERE key_name = \'entity_test_update_field__new_base_field\' and column_name = \'new_base_field\'')->fetchObject();
$this->assertEquals(191, $result->Sub_part, 'The index length has been restricted to 191 characters for UTF8MB4 compatibility.');
}
@@ -803,7 +803,7 @@ class EntityDefinitionUpdateMultipleTypesTest extends EntityKernelTestBase {
$this->assertTrue($this->database->schema()->indexExists('entity_test_update', 'entity_test_update__type_index'), "New index 'entity_test_update__type_index' has been created on the 'entity_test_update' table.");
// Check index size in for MySQL.
- if (Database::getConnection()->driver() == 'mysql') {
+ if (in_array(Database::getConnection()->driver(), ['mysql', 'mysqli'])) {
$result = Database::getConnection()->query('SHOW INDEX FROM {entity_test_update} WHERE key_name = \'entity_test_update__type_index\' and column_name = \'type\'')->fetchObject();
$this->assertEquals(191, $result->Sub_part, 'The index length has been restricted to 191 characters for UTF8MB4 compatibility.');
}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index 1c65e7f9642..4c5e2c966ae 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -254,7 +254,7 @@ class EntityFieldTest extends EntityKernelTestBase {
// Test emptying a field by assigning an empty value, NULL and an empty
// array behave the same.
foreach ([NULL, [], 'unset'] as $empty) {
- // Make sure a value is present
+ // Make sure a value is present.
$entity->name->value = 'a value';
$this->assertTrue(isset($entity->name->value), "$entity_type: Name is set.");
// Now, empty the field.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index 3140cab146b..920ddd114c1 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -426,6 +426,7 @@ class EntityQueryTest extends EntityKernelTestBase {
// As we do not have any conditions, here are the possible colors and
// language codes, already in order, with the first occurrence of the
// entity id marked with *:
+
// 8 NULL pl *
// 12 NULL pl *
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index 8b6d9ed52eb..5d04166e294 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -503,7 +503,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase {
$expected = 'short_entity_type_revision__short_field_name';
$this->assertEquals($expected, $this->tableMapping->getDedicatedRevisionTableName($field_storage));
- // Short entity type, long field name
+ // Short entity type, long field name.
$entity_type = 'short_entity_type';
$field_name = 'long_field_name_abcdefghijklmnopqrstuvwxyz';
$field_storage = FieldStorageConfig::create([
@@ -516,7 +516,7 @@ class FieldSqlStorageTest extends EntityKernelTestBase {
$expected = 'short_entity_type_r__' . substr(hash('sha256', $field_storage->uuid()), 0, 10);
$this->assertEquals($expected, $this->tableMapping->getDedicatedRevisionTableName($field_storage));
- // Long entity type, short field name
+ // Long entity type, short field name.
$entity_type = 'long_entity_type_all_forty_three_characters';
$field_name = 'short_field_name';
$field_storage = FieldStorageConfig::create([
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
index 0981068243e..b3146ebb145 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleExtensionListTest.php
@@ -22,7 +22,7 @@ class ModuleExtensionListTest extends KernelTestBase {
->save();
// The installation profile is provided by a container parameter.
- // Saving the configuration doesn't automatically trigger invalidation
+ // Saving the configuration doesn't automatically trigger invalidation.
$this->container->get('kernel')->rebuildContainer();
/** @var \Drupal\Core\Extension\ModuleExtensionList $module_extension_list */
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
index 8ee28a968fd..c90cb5e0aad 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\KernelTests\Core\Extension;
use Drupal\Core\Extension\Exception\UnknownExtensionException;
+use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\KernelTests\KernelTestBase;
/**
@@ -36,4 +37,78 @@ class ModuleHandlerTest extends KernelTestBase {
$this->assertNotNull(\Drupal::service('module_handler')->getName('module_test'));
}
+ /**
+ * Tests that resetImplementations() clears the hook memory cache.
+ *
+ * @covers ::resetImplementations
+ */
+ public function testResetImplementationsClearsHooks(): void {
+ $oldModuleHandler = \Drupal::moduleHandler();
+ $this->assertHasResetHookImplementations(FALSE, $oldModuleHandler);
+
+ // Installing a module does not trigger ->resetImplementations().
+ /** @var \Drupal\Core\Extension\ModuleInstallerInterface $moduleInstaller */
+ $moduleInstaller = \Drupal::service('module_installer');
+ $moduleInstaller->install(['module_test']);
+ $this->assertHasResetHookImplementations(FALSE, $oldModuleHandler);
+ // Only the new ModuleHandler instance has the updated implementations.
+ $moduleHandler = \Drupal::moduleHandler();
+ $this->assertHasResetHookImplementations(TRUE, $moduleHandler);
+ $backupModuleList = $moduleHandler->getModuleList();
+ $moduleListWithout = array_diff_key($backupModuleList, ['module_test' => TRUE]);
+ $this->assertArrayHasKey('module_test', $backupModuleList);
+
+ // Silently setting the property does not clear the hooks cache.
+ $moduleListProperty = (new \ReflectionProperty($moduleHandler, 'moduleList'));
+ $this->assertSame($backupModuleList, $moduleListProperty->getValue($moduleHandler));
+ $moduleListProperty->setValue($moduleHandler, $moduleListWithout);
+ $this->assertHasResetHookImplementations(TRUE, $moduleHandler);
+
+ // Directly calling ->resetImplementations() clears the hook caches.
+ $moduleHandler->resetImplementations();
+ $this->assertHasResetHookImplementations(FALSE, $moduleHandler);
+ $moduleListProperty->setValue($moduleHandler, $backupModuleList);
+ $this->assertHasResetHookImplementations(FALSE, $moduleHandler);
+ $moduleHandler->resetImplementations();
+ $this->assertHasResetHookImplementations(TRUE, $moduleHandler);
+
+ // Calling ->setModuleList() triggers ->resetImplementations().
+ $moduleHandler->setModuleList(['system']);
+ $this->assertHasResetHookImplementations(FALSE, $moduleHandler);
+ $moduleHandler->setModuleList($backupModuleList);
+ $this->assertHasResetHookImplementations(TRUE, $moduleHandler);
+
+ // Uninstalling a module triggers ->resetImplementations().
+ /** @var \Drupal\Core\Extension\ModuleInstallerInterface $moduleInstaller */
+ $moduleInstaller = \Drupal::service('module_installer');
+ $moduleInstaller->uninstall(['module_test']);
+ $this->assertSame($moduleListWithout, $moduleHandler->getModuleList());
+ $this->assertHasResetHookImplementations(FALSE, $moduleHandler);
+ }
+
+ /**
+ * Asserts whether certain hook implementations exist.
+ *
+ * This is used to verify that all internal hook cache properties have been
+ * reset and updated.
+ *
+ * @param bool $exists
+ * TRUE if the implementations are expected to exist, FALSE if not.
+ * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
+ * The module handler.
+ *
+ * @see \module_test_test_reset_implementations_hook()
+ * @see \module_test_test_reset_implementations_alter()
+ */
+ protected function assertHasResetHookImplementations(bool $exists, ModuleHandlerInterface $moduleHandler): void {
+ $this->assertSame($exists, $moduleHandler->hasImplementations('test_reset_implementations_hook'));
+ $this->assertSame($exists, $moduleHandler->hasImplementations('test_reset_implementations_alter'));
+ $expected_list = $exists ? ['module_test_test_reset_implementations_hook'] : [];
+ $this->assertSame($expected_list, $moduleHandler->invokeAll('test_reset_implementations_hook'));
+ $expected_alter_list = $exists ? ['module_test_test_reset_implementations_alter'] : [];
+ $alter_list = [];
+ $moduleHandler->alter('test_reset_implementations', $alter_list);
+ $this->assertSame($expected_alter_list, $alter_list);
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
index 0ccae25b155..5bf173aff86 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ThemeExtensionListTest.php
@@ -22,7 +22,7 @@ class ThemeExtensionListTest extends KernelTestBase {
->save();
// The installation profile is provided by a container parameter.
- // Saving the configuration doesn't automatically trigger invalidation
+ // Saving the configuration doesn't automatically trigger invalidation.
$this->container->get('kernel')->rebuildContainer();
/** @var \Drupal\Core\Extension\ThemeExtensionList $theme_extension_list */
diff --git a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php
index 0262f800bc8..e9815b9a6b8 100644
--- a/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Field/Entity/BaseFieldOverrideTest.php
@@ -96,7 +96,8 @@ class BaseFieldOverrideTest extends KernelTestBase {
->setTargetEntityTypeId('entity_test')
->setReadOnly(TRUE)
// Ensure that the internal property is inherited from the base field and
- // not the parent class. @see FieldConfigBase::isInternal
+ // not the parent class.
+ // @see FieldConfigBase::isInternal
->setInternal(TRUE)
->setComputed(FALSE);
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php
index a7bf5b9dd70..56d26fdafdb 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php
@@ -21,7 +21,7 @@ class FileCopyTest extends FileTestBase {
* Copy a normal file.
*/
public function testNormal(): void {
- // Create a file for testing
+ // Create a file for testing.
$uri = $this->createUri();
// Copying to a new name.
@@ -51,7 +51,7 @@ class FileCopyTest extends FileTestBase {
* Copy a non-existent file.
*/
public function testNonExistent(): void {
- // Copy non-existent file
+ // Copy non-existent file.
$desired_filepath = $this->randomMachineName();
$this->assertFileDoesNotExist($desired_filepath);
$this->expectException(FileNotExistsException::class);
@@ -63,7 +63,7 @@ class FileCopyTest extends FileTestBase {
* Copy a file onto itself.
*/
public function testOverwriteSelf(): void {
- // Create a file for testing
+ // Create a file for testing.
$uri = $this->createUri();
// Copy the file onto itself with renaming works.
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php
index 8fa28491f6a..761e408a878 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php
@@ -15,7 +15,7 @@ class FileDeleteRecursiveTest extends FileTestBase {
* Delete a normal file.
*/
public function testSingleFile(): void {
- // Create a file for testing
+ // Create a file for testing.
$filepath = 'public://' . $this->randomMachineName();
file_put_contents($filepath, '');
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php
index 27a76157bb0..aacba78f408 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php
@@ -17,10 +17,10 @@ class FileDeleteTest extends FileTestBase {
* Delete a normal file.
*/
public function testNormal(): void {
- // Create a file for testing
+ // Create a file for testing.
$uri = $this->createUri();
- // Delete a regular file
+ // Delete a regular file.
$this->assertTrue(\Drupal::service('file_system')->delete($uri), 'Deleted worked.');
$this->assertFileDoesNotExist($uri);
}
@@ -29,7 +29,7 @@ class FileDeleteTest extends FileTestBase {
* Try deleting a missing file.
*/
public function testMissing(): void {
- // Try to delete a non-existing file
+ // Try to delete a non-existing file.
$this->assertTrue(\Drupal::service('file_system')->delete('public://' . $this->randomMachineName()), 'Returns true when deleting a non-existent file.');
}
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php
index bc0d8073153..e9236bc918c 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php
@@ -21,7 +21,7 @@ class FileMoveTest extends FileTestBase {
* Move a normal file.
*/
public function testNormal(): void {
- // Create a file for testing
+ // Create a file for testing.
$uri = $this->createUri();
// Moving to a new name.
diff --git a/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php b/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php
index 0cb098bfcca..ca1fab258f3 100644
--- a/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/FileSystemRequirementsTest.php
@@ -45,8 +45,14 @@ class FileSystemRequirementsTest extends KernelTestBase {
* An array of system requirements.
*/
protected function checkSystemRequirements() {
+ // This loadInclude() is to ensure that the install API is available.
+ // Since we're loading an include of type 'install', this will also
+ // include core/includes/install.inc for us, which is where
+ // drupal_verify_install_file() is currently defined.
+ // @todo Remove this once the function lives in a better place.
+ // @see https://www.drupal.org/project/drupal/issues/3526388
$this->container->get('module_handler')->loadInclude('system', 'install');
- return system_requirements('runtime');
+ return \Drupal::moduleHandler()->invoke('system', 'runtime_requirements');
}
}
diff --git a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
index dfe537e4d1f..7d1e641f485 100644
--- a/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/HtaccessTest.php
@@ -92,6 +92,15 @@ class HtaccessTest extends KernelTestBase {
}
/**
+ * @covers ::write
+ */
+ public function testHtaccessSaveDisabled(): void {
+ $this->setSetting('auto_create_htaccess', FALSE);
+ $this->assertTrue($this->htaccessWriter->write($this->public, FALSE));
+ $this->assertFileDoesNotExist($this->public . '/.htaccess');
+ }
+
+ /**
* Asserts expected file permissions for a given file.
*
* @param string $uri
diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php
index 8cb96454408..df359c2873f 100644
--- a/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php
@@ -60,7 +60,7 @@ class ExtensionMimeTypeGuesserLegacyTest extends KernelTestBase {
];
$this->expectDeprecation(
- 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: file_deprecated_test_file_mimetype_mapping_alter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040'
+ 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: Drupal\file_deprecated_test\Hook\FileDeprecatedTestThemeHooks::fileMimetypeMappingAlter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040'
);
/** @var \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser $guesser */
diff --git a/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php b/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php
index ae713fc27ae..2eb87a14242 100644
--- a/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/MimeType/LegacyMimeTypeTest.php
@@ -27,7 +27,7 @@ class LegacyMimeTypeTest extends KernelTestBase {
*/
public function testHookFileMimetypeMappingAlter(): void {
$this->expectDeprecation(
- 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: file_deprecated_test_file_mimetype_mapping_alter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040'
+ 'The deprecated alter hook hook_file_mimetype_mapping_alter() is implemented in these locations: Drupal\file_deprecated_test\Hook\FileDeprecatedTestThemeHooks::fileMimetypeMappingAlter. This hook is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Implement a \Drupal\Core\File\Event\MimeTypeMapLoadedEvent listener instead. See https://www.drupal.org/node/3494040'
);
$map = \Drupal::service(MimeTypeMapInterface::class);
diff --git a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
index 54f01270198..8bfcc728c64 100644
--- a/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
@@ -38,51 +38,51 @@ class ReadOnlyStreamWrapperTest extends FileTestBase {
// Checks that the stream wrapper type is declared as local.
$this->assertSame(1, $type & StreamWrapperInterface::LOCAL);
- // Generate a test file
+ // Generate a test file.
$filename = $this->randomMachineName();
$site_path = $this->container->getParameter('site.path');
$filepath = $site_path . '/files/' . $filename;
file_put_contents($filepath, $filename);
- // Generate a read-only stream wrapper instance
+ // Generate a read-only stream wrapper instance.
$uri = $this->scheme . '://' . $filename;
\Drupal::service('stream_wrapper_manager')->getViaScheme($this->scheme);
$file_system = \Drupal::service('file_system');
- // Attempt to open a file in read/write mode
+ // Attempt to open a file in read/write mode.
$handle = @fopen($uri, 'r+');
$this->assertFalse($handle, 'Unable to open a file for reading and writing with the read-only stream wrapper.');
- // Attempt to open a file in binary read mode
+ // Attempt to open a file in binary read mode.
$handle = fopen($uri, 'rb');
$this->assertNotFalse($handle, 'Able to open a file for reading in binary mode with the read-only stream wrapper.');
$this->assertTrue(fclose($handle), 'Able to close file opened in binary mode using the read_only stream wrapper.');
- // Attempt to open a file in text read mode
+ // Attempt to open a file in text read mode.
$handle = fopen($uri, 'rt');
$this->assertNotFalse($handle, 'Able to open a file for reading in text mode with the read-only stream wrapper.');
$this->assertTrue(fclose($handle), 'Able to close file opened in text mode using the read_only stream wrapper.');
- // Attempt to open a file in read mode
+ // Attempt to open a file in read mode.
$handle = fopen($uri, 'r');
$this->assertNotFalse($handle, 'Able to open a file for reading with the read-only stream wrapper.');
- // Attempt to change file permissions
+ // Attempt to change file permissions.
$this->assertFalse(@chmod($uri, 0777), 'Unable to change file permissions when using read-only stream wrapper.');
- // Attempt to acquire an exclusive lock for writing
+ // Attempt to acquire an exclusive lock for writing.
$this->assertFalse(@flock($handle, LOCK_EX | LOCK_NB), 'Unable to acquire an exclusive lock using the read-only stream wrapper.');
- // Attempt to obtain a shared lock
+ // Attempt to obtain a shared lock.
$this->assertTrue(flock($handle, LOCK_SH | LOCK_NB), 'Able to acquire a shared lock using the read-only stream wrapper.');
- // Attempt to release a shared lock
+ // Attempt to release a shared lock.
$this->assertTrue(flock($handle, LOCK_UN | LOCK_NB), 'Able to release a shared lock using the read-only stream wrapper.');
- // Attempt to truncate the file
+ // Attempt to truncate the file.
$this->assertFalse(@ftruncate($handle, 0), 'Unable to truncate using the read-only stream wrapper.');
- // Attempt to write to the file
+ // Attempt to write to the file.
$this->assertEquals(0, @fwrite($handle, $this->randomMachineName()), 'Unable to write to file using the read-only stream wrapper.');
- // Attempt to flush output to the file
+ // Attempt to flush output to the file.
$this->assertFalse(@fflush($handle), 'Unable to flush output to file using the read-only stream wrapper.');
// Attempt to close the stream. (Suppress errors, as fclose triggers
// fflush.)
$this->assertTrue(fclose($handle), 'Able to close file using the read_only stream wrapper.');
- // Test the rename() function
+ // Test the rename() function.
$this->assertFalse(@rename($uri, $this->scheme . '://new_name.txt'), 'Unable to rename files using the read-only stream wrapper.');
- // Test the unlink() function
+ // Test the unlink() function.
$this->assertTrue(@$file_system->unlink($uri), 'Able to unlink file using read-only stream wrapper.');
$this->assertFileExists($filepath);
@@ -93,7 +93,7 @@ class ReadOnlyStreamWrapperTest extends FileTestBase {
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
$this->assertFalse(@$file_system->mkdir($read_only_dir, 0775, 0), 'Unable to create directory with read-only stream wrapper.');
- // Create a temporary directory for testing purposes
+ // Create a temporary directory for testing purposes.
$this->assertTrue($file_system->mkdir($dir), 'Test directory created.');
// Test the rmdir() function by attempting to remove the directory.
$this->assertFalse(@$file_system->rmdir($read_only_dir), 'Unable to delete directory with read-only stream wrapper.');
diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
index 91af498b01c..f689e4d9124 100644
--- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php
@@ -38,7 +38,7 @@ abstract class StorageTestBase extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
- // Define two data collections,
+ // Define two data collections.
$this->collections = [0 => 'zero', 1 => 'one'];
// Create several objects for testing.
diff --git a/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php b/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php
index fdfa189b880..8fc0c2013d2 100644
--- a/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php
@@ -319,4 +319,54 @@ YAML
$recipe->input->collectAll($collector);
}
+ /**
+ * Tests getting default input values from environment variables.
+ */
+ public function testDefaultInputFromEnvironmentVariables(): void {
+ $this->config('system.site')
+ ->set('name', 'Hello Thar')
+ ->set('slogan', 'Very important')
+ ->save();
+
+ $recipe = $this->createRecipe(<<<YAML
+name: 'Input from environment variables'
+input:
+ name:
+ data_type: string
+ description: The name of the site.
+ default:
+ source: env
+ env: SITE_NAME
+ slogan:
+ data_type: string
+ description: The site slogan.
+ default:
+ source: env
+ env: SITE_SLOGAN
+config:
+ actions:
+ system.site:
+ simpleConfigUpdate:
+ name: \${name}
+ slogan: \${slogan}
+YAML
+ );
+ putenv('SITE_NAME=Input Test');
+
+ // Mock a collector that only returns the default value.
+ $collector = $this->createMock(InputCollectorInterface::class);
+ $collector->expects($this->any())
+ ->method('collectValue')
+ ->withAnyParameters()
+ ->willReturnArgument(2);
+ $recipe->input->collectAll($collector);
+
+ RecipeRunner::processRecipe($recipe);
+ $config = $this->config('system.site');
+ $this->assertSame('Input Test', $config->get('name'));
+ // There was no SITE_SLOGAN environment variable, so it should have been
+ // set to an empty string.
+ $this->assertSame('', $config->get('slogan'));
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Recipe/RecipeValidationTest.php b/core/tests/Drupal/KernelTests/Core/Recipe/RecipeValidationTest.php
index 62f14df4d20..64b4c17869f 100644
--- a/core/tests/Drupal/KernelTests/Core/Recipe/RecipeValidationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Recipe/RecipeValidationTest.php
@@ -761,6 +761,36 @@ extra:
YAML,
NULL,
];
+ yield 'input env variable name is not a string' => [
+ <<<YAML
+name: Bad input
+input:
+ bad_news:
+ data_type: string
+ description: 'Bad default definition'
+ default:
+ source: env
+ env: -40
+YAML,
+ [
+ '[input][bad_news][default][env]' => ['This value should be of type string.'],
+ ],
+ ];
+ yield 'input env variable name is empty' => [
+ <<<YAML
+name: Bad input
+input:
+ bad_news:
+ data_type: string
+ description: 'Bad default definition'
+ default:
+ source: env
+ env: ''
+YAML,
+ [
+ '[input][bad_news][default][env]' => ['This value should not be blank.'],
+ ],
+ ];
}
/**
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php
index 09931b10f3a..16c0a7fe12b 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/DeprecatedElementTest.php
@@ -43,7 +43,8 @@ class DeprecatedElementTest extends KernelTestBase {
], $info_manager->getInfo('deprecated_extends_form'));
// Ensure the constructor is triggering a deprecation error.
- $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
+ $previous_error_handler = get_error_handler();
+ set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
// Convert deprecation error into a catchable exception.
if ($severity === E_USER_DEPRECATED) {
throw new \ErrorException($message, 0, $severity, $file, $line);
@@ -84,7 +85,8 @@ class DeprecatedElementTest extends KernelTestBase {
* Test use of static methods trigger deprecations.
*/
public function testDeprecatedStaticMethods(): void {
- $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
+ $previous_error_handler = get_error_handler();
+ set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
// Convert deprecation error into a catchable exception.
if ($severity === E_USER_DEPRECATED) {
throw new \ErrorException($message, 0, $severity, $file, $line);
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php
index 7ad8afa75be..c300cd4c019 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php
@@ -23,7 +23,7 @@ class PluginAlterTest extends KernelTestBase {
$info_manager = $this->container->get('plugin.manager.element_info');
$this->assertArrayHasKey('weight', $info_manager->getDefinitions());
- // @see element_info_test_element_plugin_alter()
+ // @see ElementInfoTestHooks::elementPluginAlter().
$this->container->get('state')->set('hook_element_plugin_alter:remove_weight', TRUE);
// The definition will be cached.
$this->assertArrayHasKey('weight', $info_manager->getDefinitions());
@@ -33,4 +33,27 @@ class PluginAlterTest extends KernelTestBase {
$this->assertArrayNotHasKey('weight', $info_manager->getDefinitions());
}
+ /**
+ * Tests hook_element_plugin_alter().
+ */
+ public function testPluginClassSwap(): void {
+ $info_manager = $this->container->get('plugin.manager.element_info');
+ $test_details = [
+ '#type' => 'details',
+ '#title' => 'Title',
+ '#description' => 'Description',
+ '#open' => TRUE,
+ ];
+
+ // @see ElementInfoTestHooks::elementPluginAlter().
+ $expected = [
+ 'class' => 'Drupal\element_info_test\Render\Element\Details',
+ 'provider' => 'element_info_test',
+ 'id' => 'details',
+ ];
+ $this->assertEquals($expected, $info_manager->getDefinitions()['details']);
+ \Drupal::service('renderer')->renderRoot($test_details);
+ $this->assertArrayHasKey('#custom', $test_details);
+ }
+
}
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php
index 00b7948f2a8..e36da16d902 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php
@@ -8,6 +8,7 @@ use Drupal\Core\Form\FormState;
use Drupal\Core\Render\Element\Number;
use Drupal\Core\Render\Element\Select;
use Drupal\Core\Render\Element\Weight;
+use Drupal\Core\Render\ElementInfoManagerInterface;
use Drupal\element_info_test\ElementInfoTestNumberBuilder;
use Drupal\KernelTests\KernelTestBase;
@@ -40,7 +41,7 @@ class WeightTest extends KernelTestBase {
$form_state = new FormState();
$complete_form = [];
- $element_object = new Weight([], 'weight', []);
+ $element_object = new Weight([], 'weight', [], elementInfoManager: $this->createStub(ElementInfoManagerInterface::class));
$info = $element_object->getInfo();
$element += $info;
diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
index 4cc3a8148ef..5ef26929c46 100644
--- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
@@ -706,7 +706,7 @@ class RouteProviderTest extends KernelTestBase {
$this->assertEquals(0, $result->count());
$candidates = $provider->getCandidateOutlines(explode('/', trim($shortest, '/')));
$this->assertCount(7, $candidates);
- // A longer patten is not found and returns no candidates
+ // A longer patten is not found and returns no candidates.
$path_to_test = '/test/1/test2/2/test3/3/4/5/6/test4';
$result = $provider->getRoutesByPattern($path_to_test);
$this->assertEquals(0, $result->count());
diff --git a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiFindAllClassFilesTest.php b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiFindAllClassFilesTest.php
index feb6addef2a..a8697cc8496 100644
--- a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiFindAllClassFilesTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiFindAllClassFilesTest.php
@@ -31,24 +31,23 @@ class PhpUnitApiFindAllClassFilesTest extends KernelTestBase {
#[DataProvider('argumentsProvider')]
#[IgnoreDeprecations]
public function testEquality(?string $extension = NULL, ?string $directory = NULL): void {
- $testDiscovery = new TestDiscovery(
- $this->container->getParameter('app.root'),
- $this->container->get('class_loader')
- );
- $internalList = $testDiscovery->findAllClassFiles($extension, $directory);
-
- // Location of PHPUnit configuration file.
+ // PHPUnit discovery.
$configurationFilePath = $this->container->getParameter('app.root') . \DIRECTORY_SEPARATOR . 'core';
// @todo once PHPUnit 10 is no longer used, remove the condition.
// @see https://www.drupal.org/project/drupal/issues/3497116
if (RunnerVersion::getMajor() >= 11) {
$configurationFilePath .= \DIRECTORY_SEPARATOR . '.phpunit-next.xml';
}
-
- $phpUnitTestDiscovery = new PhpUnitTestDiscovery($configurationFilePath);
-
+ $phpUnitTestDiscovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath($configurationFilePath);
$phpUnitList = $phpUnitTestDiscovery->findAllClassFiles($extension, $directory);
+ // Legacy TestDiscovery.
+ $testDiscovery = new TestDiscovery(
+ $this->container->getParameter('app.root'),
+ $this->container->get('class_loader')
+ );
+ $internalList = $testDiscovery->findAllClassFiles($extension, $directory);
+
// Downgrade results to make them comparable, working around bugs and
// additions.
// 1. TestDiscovery discovers non-test classes that PHPUnit does not.
diff --git a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiGetTestClassesTest.php b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiGetTestClassesTest.php
index 32d21e3e6c3..caedbc0d2b6 100644
--- a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiGetTestClassesTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitApiGetTestClassesTest.php
@@ -31,24 +31,23 @@ class PhpUnitApiGetTestClassesTest extends KernelTestBase {
#[DataProvider('argumentsProvider')]
#[IgnoreDeprecations]
public function testEquality(array $suites, ?string $extension = NULL, ?string $directory = NULL): void {
- $testDiscovery = new TestDiscovery(
- $this->container->getParameter('app.root'),
- $this->container->get('class_loader')
- );
- $internalList = $testDiscovery->getTestClasses($extension, $suites, $directory);
-
- // Location of PHPUnit configuration file.
+ // PHPUnit discovery.
$configurationFilePath = $this->container->getParameter('app.root') . \DIRECTORY_SEPARATOR . 'core';
// @todo once PHPUnit 10 is no longer used, remove the condition.
// @see https://www.drupal.org/project/drupal/issues/3497116
if (RunnerVersion::getMajor() >= 11) {
$configurationFilePath .= \DIRECTORY_SEPARATOR . '.phpunit-next.xml';
}
-
- $phpUnitTestDiscovery = new PhpUnitTestDiscovery($configurationFilePath);
-
+ $phpUnitTestDiscovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath($configurationFilePath);
$phpUnitList = $phpUnitTestDiscovery->getTestClasses($extension, $suites, $directory);
+ // Legacy TestDiscovery.
+ $testDiscovery = new TestDiscovery(
+ $this->container->getParameter('app.root'),
+ $this->container->get('class_loader')
+ );
+ $internalList = $testDiscovery->getTestClasses($extension, $suites, $directory);
+
// Downgrade results to make them comparable, working around bugs and
// additions.
// 1. Remove TestDiscovery empty groups.
diff --git a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitTestDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitTestDiscoveryTest.php
index d8534458049..345cc9282d2 100644
--- a/core/tests/Drupal/KernelTests/Core/Test/PhpUnitTestDiscoveryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Test/PhpUnitTestDiscoveryTest.php
@@ -9,8 +9,6 @@ use Drupal\KernelTests\KernelTestBase;
use Drupal\TestTools\PhpUnitCompatibility\RunnerVersion;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
-use PHPUnit\TextUI\Configuration\Builder;
-use PHPUnit\TextUI\Configuration\TestSuiteBuilder;
use Symfony\Component\Process\Process;
/**
@@ -28,6 +26,7 @@ use Symfony\Component\Process\Process;
#[Group('TestSuites')]
#[Group('Test')]
#[Group('#slow')]
+#[IgnoreDeprecations]
class PhpUnitTestDiscoveryTest extends KernelTestBase {
private const TEST_LIST_MISMATCH_MESSAGE =
@@ -62,7 +61,6 @@ class PhpUnitTestDiscoveryTest extends KernelTestBase {
/**
* Tests equality of test discovery between run-tests.sh and PHPUnit CLI.
*/
- #[IgnoreDeprecations]
public function testPhpUnitTestDiscoveryEqualsInternal(): void {
// Drupal's test discovery, used by run-tests.sh.
$testDiscovery = new TestDiscovery(
@@ -122,21 +120,6 @@ class PhpUnitTestDiscoveryTest extends KernelTestBase {
// Check against Drupal's discovery.
$this->assertEquals(implode("\n", $phpUnitClientList), implode("\n", $internalList), self::TEST_LIST_MISMATCH_MESSAGE);
-
- // PHPUnit's test discovery - via API.
- $phpUnitConfiguration = (new Builder())->build(['--configuration', $configurationFilePath]);
- $phpUnitTestSuite = (new TestSuiteBuilder())->build($phpUnitConfiguration);
- $phpUnitApiList = [];
- foreach ($phpUnitTestSuite->tests() as $testSuite) {
- foreach ($testSuite->tests() as $test) {
- $phpUnitApiList[] = $test->name();
- }
- }
- asort($phpUnitApiList);
-
- // Check against Drupal's discovery.
- $this->assertEquals(implode("\n", $phpUnitApiList), implode("\n", $internalList), self::TEST_LIST_MISMATCH_MESSAGE);
-
}
}
diff --git a/core/tests/Drupal/KernelTests/Core/Validation/UriHostValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Validation/UriHostValidatorTest.php
new file mode 100644
index 00000000000..aa845c50b1d
--- /dev/null
+++ b/core/tests/Drupal/KernelTests/Core/Validation/UriHostValidatorTest.php
@@ -0,0 +1,74 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\KernelTests\Core\Validation;
+
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Tests the UriHost validator.
+ *
+ * @group Validation
+ */
+class UriHostValidatorTest extends KernelTestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static $modules = ['config_test'];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->installConfig('config_test');
+ }
+
+ /**
+ * @see \Drupal\Core\Validation\Plugin\Validation\Constraint\UriHostConstraint
+ */
+ public function testUriHost(): void {
+ $typed_config_manager = \Drupal::service('config.typed');
+ /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_config */
+ $typed_config = $typed_config_manager->get('config_test.validation');
+
+ // Test valid names.
+ $typed_config->get('host')->setValue('example.com');
+ $this->assertCount(0, $typed_config->validate());
+
+ $typed_config->get('host')->setValue('example.com.');
+ $this->assertCount(0, $typed_config->validate());
+
+ $typed_config->get('host')->setValue('default');
+ $this->assertCount(0, $typed_config->validate());
+
+ // Test invalid names.
+ $typed_config->get('host')->setValue('.example.com');
+ $this->assertCount(1, $typed_config->validate());
+
+ // Test valid IPv6 literals.
+ $typed_config->get('host')->setValue('[::1]');
+ $this->assertCount(0, $typed_config->validate());
+
+ $typed_config->get('host')->setValue('[2001:DB8::]');
+ $this->assertCount(0, $typed_config->validate());
+
+ $typed_config->get('host')->setValue('[2001:db8:dd54:4473:bd6e:52db:10b3:4abe]');
+ $this->assertCount(0, $typed_config->validate());
+
+ // Test invalid IPv6 literals.
+ $typed_config->get('host')->setValue('::1');
+ $this->assertCount(1, $typed_config->validate());
+
+ // Test valid IPv4 addresses.
+ $typed_config->get('host')->setValue('127.0.0.1');
+ $this->assertCount(0, $typed_config->validate());
+
+ $typed_config->get('host')->setValue('192.0.2.254');
+ $this->assertCount(0, $typed_config->validate());
+ }
+
+}
diff --git a/core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php
index 7c7d6aa0e39..5889553a149 100644
--- a/core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php
@@ -44,48 +44,4 @@ class UuidValidatorTest extends KernelTestBase {
$this->assertCount(1, $typed_config->validate());
}
- /**
- * @see \Drupal\Core\Validation\Plugin\Validation\Constraint\UriHostConstraint
- */
- public function testUriHost(): void {
- $typed_config_manager = \Drupal::service('config.typed');
- /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_config */
- $typed_config = $typed_config_manager->get('config_test.validation');
-
- // Test valid names.
- $typed_config->get('host')->setValue('example.com');
- $this->assertCount(0, $typed_config->validate());
-
- $typed_config->get('host')->setValue('example.com.');
- $this->assertCount(0, $typed_config->validate());
-
- $typed_config->get('host')->setValue('default');
- $this->assertCount(0, $typed_config->validate());
-
- // Test invalid names.
- $typed_config->get('host')->setValue('.example.com');
- $this->assertCount(1, $typed_config->validate());
-
- // Test valid IPv6 literals.
- $typed_config->get('host')->setValue('[::1]');
- $this->assertCount(0, $typed_config->validate());
-
- $typed_config->get('host')->setValue('[2001:DB8::]');
- $this->assertCount(0, $typed_config->validate());
-
- $typed_config->get('host')->setValue('[2001:db8:dd54:4473:bd6e:52db:10b3:4abe]');
- $this->assertCount(0, $typed_config->validate());
-
- // Test invalid IPv6 literals.
- $typed_config->get('host')->setValue('::1');
- $this->assertCount(1, $typed_config->validate());
-
- // Test valid IPv4 addresses.
- $typed_config->get('host')->setValue('127.0.0.1');
- $this->assertCount(0, $typed_config->validate());
-
- $typed_config->get('host')->setValue('192.0.2.254');
- $this->assertCount(0, $typed_config->validate());
- }
-
}
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index 34aca08f15a..02a9abbc9ad 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -439,7 +439,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
throw new \Exception('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable to run PHPUnit based functional tests outside of run-tests.sh. See https://www.drupal.org/node/2116263#skipped-tests for more information.');
}
else {
- $database = Database::convertDbUrlToConnectionInfo($db_url, $this->root, TRUE);
+ $database = Database::convertDbUrlToConnectionInfo($db_url, TRUE);
Database::addConnectionInfo('default', 'default', $database);
}
@@ -967,7 +967,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
->save();
// The installation profile is provided by a container parameter. Saving
- // the configuration doesn't automatically trigger invalidation
+ // the configuration doesn't automatically trigger invalidation.
$this->container->get('kernel')->rebuildContainer();
}
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php
index e8dfc3be6f4..828b4ab54ec 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseDatabaseDriverModuleTest.php
@@ -25,7 +25,7 @@ class KernelTestBaseDatabaseDriverModuleTest extends KernelTestBase {
throw new \Exception('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable to run PHPUnit based functional tests outside of run-tests.sh. See https://www.drupal.org/node/2116263#skipped-tests for more information.');
}
else {
- $database = Database::convertDbUrlToConnectionInfo($db_url, $this->root);
+ $database = Database::convertDbUrlToConnectionInfo($db_url);
if (in_array($database['driver'], ['mysql', 'pgsql'])) {
// Change the used database driver to the one provided by the module
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
index db658255c82..80d3d18007b 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
@@ -250,7 +250,7 @@ class KernelTestBaseTest extends KernelTestBase {
* Tests the assumption that local time is in 'Australia/Sydney'.
*/
public function testLocalTimeZone(): void {
- // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+ // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php.
$this->assertEquals('Australia/Sydney', date_default_timezone_get());
}
diff --git a/core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php
index 02521bdda2f..2f8b7309b52 100644
--- a/core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php
+++ b/core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php
@@ -286,7 +286,7 @@ class TestSiteApplicationTest extends KernelTestBase {
* The database key of the added connection.
*/
protected function addTestDatabase($db_prefix): string {
- $database = Database::convertDbUrlToConnectionInfo(getenv('SIMPLETEST_DB'), $this->root);
+ $database = Database::convertDbUrlToConnectionInfo(getenv('SIMPLETEST_DB'));
$database['prefix'] = $db_prefix;
$target = __CLASS__ . $db_prefix;
Database::addConnectionInfo($target, 'default', $database);
diff --git a/core/tests/Drupal/Nightwatch/Tests/a11yTestAdmin.js b/core/tests/Drupal/Nightwatch/Tests/a11yTestAdmin.js
index ea71f685206..3dc498246aa 100644
--- a/core/tests/Drupal/Nightwatch/Tests/a11yTestAdmin.js
+++ b/core/tests/Drupal/Nightwatch/Tests/a11yTestAdmin.js
@@ -25,6 +25,30 @@ const testCases = [
{ name: 'Structure Page', path: '/admin/structure' },
{ name: 'Add content type', path: '/admin/structure/types/add' },
{ name: 'Add vocabulary', path: '/admin/structure/taxonomy/add' },
+ {
+ // Tests long breadcrumb for https://drupal.org/i/3223147.
+ name: 'Manage text format, mobile',
+ path: '/admin/config/content/formats/manage/restricted_html',
+ windowSize: {
+ // Dimensions used by Lighthouse for mobile.
+ width: 415,
+ height: 823,
+ },
+ options: {
+ runOnly: {
+ type: 'tag',
+ values: [
+ 'wcag2a',
+ 'wcag2aa',
+ 'wcag21a',
+ 'wcag21aa',
+ 'best-practice',
+ 'wcag22a',
+ 'wcag22aa',
+ ],
+ },
+ },
+ },
// @todo remove the skipped rules below in https://drupal.org/i/3318394.
{
name: 'Structure | Block',
@@ -41,6 +65,13 @@ const testCases = [
testCases.forEach((testCase) => {
adminTest[`Accessibility - Admin Theme: ${testCase.name}`] = (browser) => {
+ if (testCase.windowSize) {
+ browser.setWindowSize(
+ testCase.windowSize.width,
+ testCase.windowSize.height,
+ );
+ }
+
browser.drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL(testCase.path)
diff --git a/core/tests/Drupal/Nightwatch/Tests/htmx/htmxTest.js b/core/tests/Drupal/Nightwatch/Tests/htmx/htmxTest.js
index 98916702a88..4705455683d 100644
--- a/core/tests/Drupal/Nightwatch/Tests/htmx/htmxTest.js
+++ b/core/tests/Drupal/Nightwatch/Tests/htmx/htmxTest.js
@@ -41,8 +41,54 @@ module.exports = {
.assert.not.elementPresent(cssSelector)
.waitForElementVisible('[name="replace"]', 1000)
.click('[name="replace"]')
- .waitForElementVisible(elementSelector, 6000)
- .waitForElementVisible(elementInitSelector, 6000)
+ .waitForElementVisible(elementSelector, 1100)
+ .waitForElementVisible(elementInitSelector, 1100)
+ .assert.elementPresent(scriptSelector)
+ .assert.elementPresent(cssSelector);
+ },
+
+ 'Swap Before': (browser) => {
+ // Load the route htmx will use for the request on click and confirm the
+ // markup we will be looking for is present in the source markup.
+ browser
+ .drupalRelativeURL('/htmx-test-attachments/replace')
+ .waitForElementVisible('body', 1000)
+ .assert.elementPresent(elementInitSelector);
+ // Now load the page with the htmx enhanced button and verify the absence
+ // of the markup to be inserted. Click the button
+ // and check for inserted javascript and markup.
+ browser
+ .drupalRelativeURL('/htmx-test-attachments/before')
+ .waitForElementVisible('body', 1000)
+ .assert.not.elementPresent(scriptSelector)
+ .assert.not.elementPresent(cssSelector)
+ .waitForElementVisible('[name="replace"]', 1000)
+ .click('[name="replace"]')
+ .waitForElementVisible(elementSelector, 1100)
+ .waitForElementVisible(elementInitSelector, 1100)
+ .assert.elementPresent(scriptSelector)
+ .assert.elementPresent(cssSelector);
+ },
+
+ 'Swap After': (browser) => {
+ // Load the route htmx will use for the request on click and confirm the
+ // markup we will be looking for is present in the source markup.
+ browser
+ .drupalRelativeURL('/htmx-test-attachments/replace')
+ .waitForElementVisible('body', 1000)
+ .assert.elementPresent(elementInitSelector);
+ // Now load the page with the htmx enhanced button and verify the absence
+ // of the markup to be inserted. Click the button
+ // and check for inserted javascript and markup.
+ browser
+ .drupalRelativeURL('/htmx-test-attachments/after')
+ .waitForElementVisible('body', 1000)
+ .assert.not.elementPresent(scriptSelector)
+ .assert.not.elementPresent(cssSelector)
+ .waitForElementVisible('[name="replace"]', 1000)
+ .click('[name="replace"]')
+ .waitForElementVisible(elementSelector, 1100)
+ .waitForElementVisible(elementInitSelector, 1100)
.assert.elementPresent(scriptSelector)
.assert.elementPresent(cssSelector);
},
@@ -69,8 +115,8 @@ module.exports = {
.waitForElementVisible('[name="replace"]', 1000)
.pause(1000)
.click('[name="replace"]')
- .waitForElementVisible(elementSelector, 6000)
- .waitForElementVisible(elementInitSelector, 6000)
+ .waitForElementVisible(elementSelector, 1100)
+ .waitForElementVisible(elementInitSelector, 1100)
.assert.elementPresent(scriptSelector)
.assert.elementPresent(cssSelector);
},
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
index 1459f0cdfee..470d3ef92e2 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
@@ -280,18 +280,18 @@ class TestSiteInstallCommand extends Command {
}
/**
- * {@inheritdoc}
+ * Changes the database connection to the prefixed one.
*/
- protected function changeDatabasePrefix() {
+ protected function changeDatabasePrefix(): void {
// Ensure that we use the database from SIMPLETEST_DB environment variable.
Database::removeConnection('default');
$this->changeDatabasePrefixTrait();
}
/**
- * {@inheritdoc}
+ * Generates a database prefix for the site installation.
*/
- protected function prepareDatabasePrefix() {
+ protected function prepareDatabasePrefix(): void {
// Override this method so that we can force a lock to be created.
$test_db = new TestDatabase(NULL, TRUE);
$this->siteDirectory = $test_db->getTestSitePath();
diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
index 3d80f3a1c17..7e601981d4c 100644
--- a/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
+++ b/core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php
@@ -84,7 +84,7 @@ class TestSiteTearDownCommand extends Command {
protected function tearDown(TestDatabase $test_database, $db_url): void {
// Connect to the test database.
$root = dirname(__DIR__, 5);
- $database = Database::convertDbUrlToConnectionInfo($db_url, $root);
+ $database = Database::convertDbUrlToConnectionInfo($db_url);
$database['prefix'] = $test_database->getDatabasePrefix();
Database::addConnectionInfo(__CLASS__, 'default', $database);
diff --git a/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php
index 26cc8a29033..14f92944b31 100644
--- a/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php
+++ b/core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php
@@ -32,17 +32,17 @@ class TestSiteClaroInstallTestScript implements TestSetupInterface {
$system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
$system_theme_config->set('default', 'claro')->save();
- // Create an article that will have no comments
+ // Create an article that will have no comments.
$article_no_comments = Node::create(['type' => 'article']);
$article_no_comments->set('title', 'Article without comments');
- // Enable comments
+ // Enable comments.
$article_no_comments->set('comment', 2);
$article_no_comments->save();
- // Create an article that will have comments
+ // Create an article that will have comments.
$article_with_comments = Node::create(['type' => 'article']);
$article_with_comments->set('title', 'Article with comments');
- // Enable comments
+ // Enable comments.
$article_with_comments->set('comment', 2);
$article_with_comments->save();
@@ -60,7 +60,7 @@ class TestSiteClaroInstallTestScript implements TestSetupInterface {
// Whether the comment is 'approved' or not.
'status' => 1,
];
- // Create comment entities out of our field values
+ // Create comment entities out of our field values.
$comment1 = Comment::create($values);
$comment1->save();
diff --git a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
index 02e945b7e2d..f175156ad05 100644
--- a/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
+++ b/core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
@@ -32,17 +32,17 @@ class TestSiteOliveroInstallTestScript implements TestSetupInterface {
$system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
$system_theme_config->set('default', 'olivero')->save();
- // Create an article that will have no comments
+ // Create an article that will have no comments.
$article_no_comments = Node::create(['type' => 'article']);
$article_no_comments->set('title', 'Article without comments');
- // Enable comments
+ // Enable comments.
$article_no_comments->set('comment', 2);
$article_no_comments->save();
- // Create an article that will have comments
+ // Create an article that will have comments.
$article_with_comments = Node::create(['type' => 'article']);
$article_with_comments->set('title', 'Article with comments');
- // Enable comments
+ // Enable comments.
$article_with_comments->set('comment', 2);
$article_with_comments->save();
@@ -60,7 +60,7 @@ class TestSiteOliveroInstallTestScript implements TestSetupInterface {
// Whether the comment is 'approved' or not.
'status' => 1,
];
- // Create comment entities out of our field values
+ // Create comment entities out of our field values.
$comment1 = Comment::create($values);
$comment1->save();
diff --git a/core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php b/core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php
index d60a4f3062c..ed73ca8fd93 100644
--- a/core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php
+++ b/core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Drupal\TestTools\Extension\DeprecationBridge;
-use Drupal\Core\Utility\Error;
use Drupal\TestTools\ErrorHandler\TestErrorHandler;
use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
@@ -41,7 +40,7 @@ trait ExpectDeprecationTrait {
}
DeprecationHandler::reset();
- set_error_handler(new TestErrorHandler(Error::currentErrorHandler(), $this));
+ set_error_handler(new TestErrorHandler(get_error_handler(), $this));
}
/**
@@ -61,8 +60,7 @@ trait ExpectDeprecationTrait {
// ::setUpErrorHandler() prior to the start of the test execution. If not,
// the error handler was changed during the test execution but not properly
// restored during ::tearDown().
- $handler = Error::currentErrorHandler();
- if (!$handler instanceof TestErrorHandler) {
+ if (!get_error_handler() instanceof TestErrorHandler) {
throw new \RuntimeException(sprintf('%s registered its own error handler without restoring the previous one before or during tear down. This can cause unpredictable test results. Ensure the test cleans up after itself.', $this->name()));
}
restore_error_handler();
diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php
index 12228dbea72..98aafad7df1 100644
--- a/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -173,16 +173,6 @@ abstract class BrowserTestBase extends TestCase {
protected $originalShutdownCallbacks = [];
/**
- * The original container.
- *
- * Move this to \Drupal\Core\Test\FunctionalTestSetupTrait once TestBase no
- * longer provides the same value.
- *
- * @var \Symfony\Component\DependencyInjection\ContainerInterface
- */
- protected $originalContainer;
-
- /**
* {@inheritdoc}
*/
public function __construct(string $name) {
@@ -512,8 +502,14 @@ abstract class BrowserTestBase extends TestCase {
*
* @return array
* Associative array of option keys and values.
+ *
+ * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. There is
+ * no direct replacement.
+ *
+ * @see https://www.drupal.org/node/3523039
*/
protected function getOptions($select, ?Element $container = NULL) {
+ @trigger_error(__METHOD__ . 'is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. There is no direct replacement. See https://www.drupal.org/node/3523039', E_DEPRECATED);
if (is_string($select)) {
$select = $this->assertSession()->selectExists($select, $container);
}
diff --git a/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php b/core/tests/Drupal/Tests/Component/Annotation/AnnotatedClassDiscoveryCachedTest.php
index 07a9fab674f..9a2b78ebc77 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 a83d030b2af..96174c14842 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 80f3b31f82b..cb5d4727b4f 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 c211193d1fd..e4cc1f2b921 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 ab5d242262d..96b501928a6 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 6511a2c980c..c227a276a1e 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 ab59964f339..7852e14c1b1 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 17fb399a726..4ff731f364f 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 ad02c2ddba4..857044e4b6c 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 0d3f5d221a3..2d02f97c571 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 9653180cfa2..0b8322303fb 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 ae46c3cc5a5..0a09e3adb4b 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 d4b02de5d30..a394e1b99c9 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 6f888037632..87cd766c288 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.');
@@ -984,7 +988,7 @@ class ContainerTest extends TestCase {
'configurator' => 'configurator_service_test_does_not_exist',
];
- // Raw argument
+ // Raw argument.
$services['service_with_raw_argument'] = [
'class' => '\Drupal\Tests\Component\DependencyInjection\MockInstantiationService',
'arguments' => $this->getCollection([$this->getRaw('ccc')]),
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php
index 99113913a7f..ed02dc435eb 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 2bdac0cc4d4..db16c20e1f8 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 696dcb85203..cb53b3cee21 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 29143ca9b2b..e68c1ad5f63 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 eb006d115e8..27e9bbd38c4 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 816def560ed..0b6521acd64 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 a592b1cea48..cc662a528cc 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 4ffa430c05b..3e4295e18ab 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 9cae565db96..503a80c4bb2 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 88aa8e2f34c..7128514f654 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 60cedeb245c..693194a66a2 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 36749ade6dd..621ce108a5b 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 90977d85fb6..618ed88d6fe 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 d5c97bdb8c7..14797ad4b3b 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
new file mode 100644
index 00000000000..d8890bac779
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php
@@ -0,0 +1,87 @@
+<?php
+
+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;
+
+/**
+ * Tests Drupal\Component\Gettext\PoItem.
+ */
+#[CoversClass(PoItem::class)]
+#[Group('Gettext')]
+class PoItemTest extends TestCase {
+
+ /**
+ * @return array
+ * - Source string
+ * - Context (optional)
+ * - Translated string (optional)
+ * - Expected value
+ */
+ public static function providerStrings(): array {
+ // cSpell:disable
+ return [
+ [
+ '',
+ NULL,
+ NULL,
+ 'msgid ""' . "\n" . 'msgstr ""' . "\n\n",
+ ],
+ // Translated String without contesxt.
+ [
+ 'Next',
+ NULL,
+ 'Suivant',
+ 'msgid "Next"' . "\n" . 'msgstr "Suivant"' . "\n\n",
+ ],
+ // Translated string with context.
+ [
+ 'Apr',
+ 'Abbreviated month name',
+ 'Avr',
+ 'msgctxt "Abbreviated month name"' . "\n" . 'msgid "Apr"' . "\n" . 'msgstr "Avr"' . "\n\n",
+ ],
+ // Translated string with placeholder.
+ [
+ '%email is not a valid email address.',
+ NULL,
+ '%email n\'est pas une adresse de courriel valide.',
+ 'msgid "%email is not a valid email address."' . "\n" . 'msgstr "%email n\'est pas une adresse de courriel valide."' . "\n\n",
+ ],
+ // Translated Plural String without context.
+ [
+ ['Installed theme', 'Installed themes'],
+ NULL,
+ ['Thème installé', 'Thèmes installés'],
+ 'msgid "Installed theme"' . "\n" . 'msgid_plural "Installed themes"' . "\n" . 'msgstr[0] "Thème installé"' . "\n" . 'msgstr[1] "Thèmes installés"' . "\n\n",
+ ],
+ ];
+ // cSpell:enable
+ }
+
+ #[DataProvider('providerStrings')]
+ public function testFormat($source, $context, $translation, $expected): void {
+ $item = new PoItem();
+
+ $item->setSource($source);
+
+ if (is_array($source)) {
+ $item->setPlural(TRUE);
+ }
+ if (!empty($context)) {
+ $item->setContext($context);
+ }
+ if (!empty($translation)) {
+ $item->setTranslation($translation);
+ }
+
+ $this->assertEquals($expected, (string) $item);
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php b/core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php
index 667c2129770..d38147f21ed 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 61002b0199b..cd0f46a3a1a 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 4fa007b1121..5c5fc82e633 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 4d4c56ef1eb..e1c05c7111c 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 bc0d8e5e908..e24013cfcc7 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 6e65e0ca8dd..90896b95a17 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 e2fea54aeb1..20adb60eb9e 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 0abed0e1233..b58c6508af6 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 1dfa467e599..e43a2c3ce36 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 92cd1ff1ef8..9fcb6a8f59f 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 aa20f8146f8..be0664d1f19 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 2791af3d3f7..0d1fbb93e6e 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 5cad2a94067..d241d5509fb 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 6004e705acf..fe5413c505f 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 f92d274cd85..16fa9ad86c4 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 483764b3c0e..8b632acae00 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 cc8d2aabcee..a85c01c7ee6 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 9db89444c17..3368c9a14ab 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 d26a538aad6..f85eeeb193c 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 b2f430416a7..2de43953ea0 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 860c96c6e22..282b2f4edf3 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 9842f252a83..d4bd2ff757d 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 5545b2e0140..26ab691bf1a 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 5e82b2daaef..4547de6b9d3 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 2b10bbfbd79..ff5e407d81b 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 21e8830fa89..57d09fddc83 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 9f24283f962..c36c4a619f9 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 {
/**
@@ -50,7 +53,7 @@ class JsonTest extends TestCase {
// Characters that must be escaped.
// We check for unescaped " separately.
$this->htmlUnsafe = ['<', '>', '\'', '&'];
- // The following are the encoded forms of: < > ' & "
+ // The following are the encoded forms of '<', '>', "'", '&', and '"'.
$this->htmlUnsafeEscaped = ['\u003C', '\u003E', '\u0027', '\u0026', '\u0022'];
}
@@ -107,7 +110,7 @@ class JsonTest extends TestCase {
foreach ($this->htmlUnsafe as $char) {
$this->assertStringNotContainsString($char, $json, sprintf('A JSON encoded string does not contain %s.', $char));
}
- // Verify that JSON encoding escapes the HTML unsafe characters
+ // Verify that JSON encoding escapes the HTML unsafe characters.
foreach ($this->htmlUnsafeEscaped as $char) {
$this->assertStringContainsString($char, $json, sprintf('A JSON encoded string contains %s.', $char));
}
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
index 8f124a85ba9..35f45159a77 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 7980f584535..ef7e51a5101 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 3badd32fab8..aa26390ae78 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 d6fadcc9fbe..438c7e70ae7 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 04c77eb0a71..3a7d57caa16 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 d78db87c02d..3fc7ae24fdb 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 7aff98aab42..b19f815f67a 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 2383752bffd..b720bad1f6d 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 b57f51c8b6a..e353785fd7d 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 6a70b028d34..fa8cf491295 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 289b19bfe82..e766d8ecf61 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 800483fab50..a01684d768d 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 e67eb9a4d16..2b0bfaab2a8 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 7a43bda8882..97f42571ca1 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 2055eecde64..fdac9baf796 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 64de3b2061a..f46b0cd9b55 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 5635173a6de..45942f226fa 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 4a0a6fb4b85..f498157f08b 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 9cc47d17d96..37a431411b3 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 470ff1de13f..12996f564f4 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 c0dbfa92d75..06e6e1ef7d4 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 0d5eb029d07..571009cf539 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 601b3195696..467d65d4d36 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 172a9b03878..d00203bfe9c 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 32f345ac016..5857d2acf7d 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);
}
@@ -609,7 +607,7 @@ class XssTest extends TestCase {
*/
public static function providerTestFilterXssAdminNotNormalized() {
return [
- // DRUPAL-SA-2008-044
+ // DRUPAL-SA-2008-044.
['<object />', 'object', 'Admin HTML filter -- should not allow object tag.'],
['<script />', 'script', 'Admin HTML filter -- should not allow script tag.'],
];
diff --git a/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php b/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
index 1d1f0b40232..26eeed78544 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 78109e573f0..566a2d207a1 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/Access/AccessGroupAndTest.php b/core/tests/Drupal/Tests/Core/Access/AccessGroupAndTest.php
new file mode 100644
index 00000000000..c3116c6f498
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Access/AccessGroupAndTest.php
@@ -0,0 +1,57 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Access;
+
+use Drupal\Core\Access\AccessGroupAnd;
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests accessible groups.
+ *
+ * @group Access
+ */
+class AccessGroupAndTest extends UnitTestCase {
+
+ use AccessibleTestingTrait;
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+ $this->account = $this->prophesize(AccountInterface::class)->reveal();
+ }
+
+ /**
+ * @covers \Drupal\Core\Access\AccessGroupAnd
+ */
+ public function testGroups(): void {
+ $allowedAccessible = $this->createAccessibleDouble(AccessResult::allowed());
+ $forbiddenAccessible = $this->createAccessibleDouble(AccessResult::forbidden());
+ $neutralAccessible = $this->createAccessibleDouble(AccessResult::neutral());
+
+ // Ensure that groups with no dependencies return a neutral access result.
+ $this->assertTrue((new AccessGroupAnd())->access('view', $this->account, TRUE)->isNeutral());
+
+ $andNeutral = new AccessGroupAnd();
+ $andNeutral->addDependency($allowedAccessible)->addDependency($neutralAccessible);
+ $this->assertTrue($andNeutral->access('view', $this->account, TRUE)->isNeutral());
+
+ $andForbidden = $andNeutral;
+ $andForbidden->addDependency($forbiddenAccessible);
+ $this->assertTrue($andForbidden->access('view', $this->account, TRUE)->isForbidden());
+
+ // Ensure that groups added to other groups works.
+ $andGroupsForbidden = new AccessGroupAnd();
+ $andGroupsForbidden->addDependency($andNeutral)->addDependency($andForbidden);
+ $this->assertTrue($andGroupsForbidden->access('view', $this->account, TRUE)->isForbidden());
+ // Ensure you can add a non-group accessible object.
+ $andGroupsForbidden->addDependency($allowedAccessible);
+ $this->assertTrue($andGroupsForbidden->access('view', $this->account, TRUE)->isForbidden());
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
index e44218405bb..1bcc9cab78d 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
@@ -207,7 +207,7 @@ class AccessResultTest extends UnitTestCase {
$this->assertEquals('forbidden message', $access->getReason());
$this->assertDefaultCacheability($access);
- // NEUTRAL && ALLOW == NEUTRAL
+ // NEUTRAL && ALLOW == NEUTRAL.
$access = $neutral->andIf($allowed);
$this->assertFalse($access->isAllowed());
$this->assertFalse($access->isForbidden());
@@ -231,7 +231,7 @@ class AccessResultTest extends UnitTestCase {
$this->assertEquals('forbidden message', $access->getReason());
$this->assertDefaultCacheability($access);
- // FORBIDDEN && ALLOWED = FORBIDDEN
+ // FORBIDDEN && ALLOWED = FORBIDDEN.
$access = $forbidden->andIf($allowed);
$this->assertFalse($access->isAllowed());
$this->assertTrue($access->isForbidden());
@@ -239,7 +239,7 @@ class AccessResultTest extends UnitTestCase {
$this->assertEquals('forbidden message', $access->getReason());
$this->assertDefaultCacheability($access);
- // FORBIDDEN && NEUTRAL = FORBIDDEN
+ // FORBIDDEN && NEUTRAL = FORBIDDEN.
$access = $forbidden->andIf($neutral);
$this->assertFalse($access->isAllowed());
$this->assertTrue($access->isForbidden());
@@ -247,7 +247,7 @@ class AccessResultTest extends UnitTestCase {
$this->assertEquals('forbidden message', $access->getReason());
$this->assertDefaultCacheability($access);
- // FORBIDDEN && FORBIDDEN = FORBIDDEN
+ // FORBIDDEN && FORBIDDEN = FORBIDDEN.
$access = $forbidden->andIf($forbidden);
$this->assertFalse($access->isAllowed());
$this->assertTrue($access->isForbidden());
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessibleTestingTrait.php b/core/tests/Drupal/Tests/Core/Access/AccessibleTestingTrait.php
new file mode 100644
index 00000000000..cf6d663a91a
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Access/AccessibleTestingTrait.php
@@ -0,0 +1,38 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Access;
+
+use Drupal\Core\Access\AccessibleInterface;
+use Drupal\Core\Access\AccessResultInterface;
+
+/**
+ * Helper methods testing accessible interfaces.
+ */
+trait AccessibleTestingTrait {
+
+ /**
+ * The test account.
+ *
+ * @var \Drupal\Core\Session\AccountInterface
+ */
+ protected $account;
+
+ /**
+ * Creates AccessibleInterface object from access result object for testing.
+ *
+ * @param \Drupal\Core\Access\AccessResultInterface $accessResult
+ * The accessible result to return.
+ *
+ * @return \Drupal\Core\Access\AccessibleInterface
+ * The AccessibleInterface object.
+ */
+ private function createAccessibleDouble(AccessResultInterface $accessResult) {
+ $accessible = $this->prophesize(AccessibleInterface::class);
+ $accessible->access('view', $this->account, TRUE)
+ ->willReturn($accessResult);
+ return $accessible->reveal();
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Access/DependentAccessTest.php b/core/tests/Drupal/Tests/Core/Access/DependentAccessTest.php
new file mode 100644
index 00000000000..43e924087ab
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Access/DependentAccessTest.php
@@ -0,0 +1,161 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Access;
+
+use Drupal\Core\Access\AccessGroupAnd;
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Access\RefinableDependentAccessInterface;
+use Drupal\Core\Access\RefinableDependentAccessTrait;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Access\RefinableDependentAccessTrait
+ *
+ * @group Access
+ */
+class DependentAccessTest extends UnitTestCase {
+ use AccessibleTestingTrait;
+
+ /**
+ * An accessible object that results in forbidden access result.
+ *
+ * @var \Drupal\Core\Access\AccessibleInterface
+ */
+ protected $forbidden;
+
+ /**
+ * An accessible object that results in neutral access result.
+ *
+ * @var \Drupal\Core\Access\AccessibleInterface
+ */
+ protected $neutral;
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+ $this->account = $this->prophesize(AccountInterface::class)->reveal();
+ $this->forbidden = $this->createAccessibleDouble(AccessResult::forbidden('Because I said so'));
+ $this->neutral = $this->createAccessibleDouble(AccessResult::neutral('I have no opinion'));
+ }
+
+ /**
+ * Tests that the previous dependency is replaced when using set.
+ *
+ * @covers ::setAccessDependency
+ *
+ * @dataProvider providerTestSetFirst
+ */
+ public function testSetAccessDependency($use_set_first): void {
+ $testRefinable = new RefinableDependentAccessTraitTestClass();
+
+ if ($use_set_first) {
+ $testRefinable->setAccessDependency($this->forbidden);
+ }
+ else {
+ $testRefinable->addAccessDependency($this->forbidden);
+ }
+ $accessResult = $testRefinable->getAccessDependency()->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResult->isForbidden());
+ $this->assertEquals('Because I said so', $accessResult->getReason());
+
+ // Calling setAccessDependency() replaces the existing dependency.
+ $testRefinable->setAccessDependency($this->neutral);
+ $dependency = $testRefinable->getAccessDependency();
+ $this->assertNotInstanceOf(AccessGroupAnd::class, $dependency);
+ $accessResult = $dependency->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResult->isNeutral());
+ $this->assertEquals('I have no opinion', $accessResult->getReason());
+ }
+
+ /**
+ * Tests merging a new dependency with existing non-group access dependency.
+ *
+ * @dataProvider providerTestSetFirst
+ */
+ public function testMergeNonGroup($use_set_first): void {
+ $testRefinable = new RefinableDependentAccessTraitTestClass();
+ if ($use_set_first) {
+ $testRefinable->setAccessDependency($this->forbidden);
+ }
+ else {
+ $testRefinable->addAccessDependency($this->forbidden);
+ }
+
+ $accessResult = $testRefinable->getAccessDependency()->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResult->isForbidden());
+ $this->assertEquals('Because I said so', $accessResult->getReason());
+
+ $testRefinable->addAccessDependency($this->neutral);
+ /** @var \Drupal\Core\Access\AccessGroupAnd $dependency */
+ $dependency = $testRefinable->getAccessDependency();
+ // Ensure the new dependency create a new AND group when merged.
+ $this->assertInstanceOf(AccessGroupAnd::class, $dependency);
+ $dependencies = $dependency->getDependencies();
+ $accessResultForbidden = $dependencies[0]->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResultForbidden->isForbidden());
+ $this->assertEquals('Because I said so', $accessResultForbidden->getReason());
+ $accessResultNeutral = $dependencies[1]->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResultNeutral->isNeutral());
+ $this->assertEquals('I have no opinion', $accessResultNeutral->getReason());
+ }
+
+ /**
+ * Tests merging a new dependency with an existing access group dependency.
+ *
+ * @dataProvider providerTestSetFirst
+ */
+ public function testMergeGroup($use_set_first): void {
+ $andGroup = new AccessGroupAnd();
+ $andGroup->addDependency($this->forbidden);
+ $testRefinable = new RefinableDependentAccessTraitTestClass();
+ if ($use_set_first) {
+ $testRefinable->setAccessDependency($andGroup);
+ }
+ else {
+ $testRefinable->addAccessDependency($andGroup);
+ }
+
+ $testRefinable->addAccessDependency($this->neutral);
+ /** @var \Drupal\Core\Access\AccessGroupAnd $dependency */
+ $dependency = $testRefinable->getAccessDependency();
+
+ // Ensure the new dependency is merged with the existing group.
+ $this->assertInstanceOf(AccessGroupAnd::class, $dependency);
+ $dependencies = $dependency->getDependencies();
+ $accessResultForbidden = $dependencies[0]->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResultForbidden->isForbidden());
+ $this->assertEquals('Because I said so', $accessResultForbidden->getReason());
+ $accessResultNeutral = $dependencies[1]->access('view', $this->account, TRUE);
+ $this->assertTrue($accessResultNeutral->isNeutral());
+ $this->assertEquals('I have no opinion', $accessResultNeutral->getReason());
+ }
+
+ /**
+ * Data provider for all test methods.
+ *
+ * Provides test cases for calling setAccessDependency() or
+ * mergeAccessDependency() first. A call to either should behave the same on a
+ * new RefinableDependentAccessInterface object.
+ */
+ public static function providerTestSetFirst(): array {
+ return [
+ [TRUE],
+ [FALSE],
+ ];
+ }
+
+}
+
+/**
+ * Test class that implements RefinableDependentAccessInterface.
+ */
+class RefinableDependentAccessTraitTestClass implements RefinableDependentAccessInterface {
+
+ use RefinableDependentAccessTrait;
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
index ab5fce6d191..9dd5727f2a4 100644
--- a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
+++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Ajax;
use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CommandInterface;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
@@ -98,4 +99,95 @@ class AjaxResponseTest extends UnitTestCase {
$this->assertEquals('<textarea>[]</textarea>', $response->getContent());
}
+ /**
+ * Tests the mergeWith() method.
+ *
+ * @see \Drupal\Core\Ajax\AjaxResponse::mergeWith()
+ *
+ * @throws \PHPUnit\Framework\MockObject\Exception
+ */
+ public function testMergeWithOtherAjaxResponse(): void {
+ $response = new AjaxResponse([]);
+
+ $command_one = $this->createCommandMock('one');
+
+ $command_two = $this->createCommandMockWithSettingsAndLibrariesAttachments(
+ 'Drupal\Core\Ajax\HtmlCommand', [
+ 'setting1' => 'value1',
+ 'setting2' => 'value2',
+ ], ['jquery', 'drupal'], 'two');
+ $command_three = $this->createCommandMockWithSettingsAndLibrariesAttachments(
+ 'Drupal\Core\Ajax\InsertCommand', [
+ 'setting1' => 'overridden',
+ 'setting3' => 'value3',
+ ], ['jquery', 'ajax'], 'three');
+
+ $response->addCommand($command_one);
+ $response->addCommand($command_two);
+
+ $response2 = new AjaxResponse([]);
+ $response2->addCommand($command_three);
+
+ $response->mergeWith($response2);
+ self::assertEquals([
+ 'library' => ['jquery', 'drupal', 'jquery', 'ajax'],
+ 'drupalSettings' => [
+ 'setting1' => 'overridden',
+ 'setting2' => 'value2',
+ 'setting3' => 'value3',
+ ],
+ ], $response->getAttachments());
+ self::assertEquals([['command' => 'one'], ['command' => 'two'], ['command' => 'three']], $response->getCommands());
+ }
+
+ /**
+ * Creates a mock of a provided subclass of CommandInterface.
+ *
+ * Adds given settings and libraries to assets mock
+ * that is attached to the command mock.
+ *
+ * @param string $command_class_name
+ * The command class name to create the mock for.
+ * @param array|null $settings
+ * The settings to attach.
+ * @param array|null $libraries
+ * The libraries to attach.
+ * @param string $command_name
+ * The command name to pass to the mock.
+ */
+ private function createCommandMockWithSettingsAndLibrariesAttachments(
+ string $command_class_name,
+ array|null $settings,
+ array|null $libraries,
+ string $command_name,
+ ): CommandInterface {
+ $command = $this->createMock($command_class_name);
+ $command->expects($this->once())
+ ->method('render')
+ ->willReturn(['command' => $command_name]);
+
+ $assets = $this->createMock('Drupal\Core\Asset\AttachedAssetsInterface');
+ $assets->expects($this->once())->method('getLibraries')->willReturn($libraries);
+ $assets->expects($this->once())->method('getSettings')->willReturn($settings);
+
+ $command->expects($this->once())->method('getAttachedAssets')->willReturn($assets);
+
+ return $command;
+ }
+
+ /**
+ * Creates a mock of the Drupal\Core\Ajax\CommandInterface.
+ *
+ * @param string $command_name
+ * The command name to pass to the mock.
+ */
+ private function createCommandMock(string $command_name): CommandInterface {
+ $command = $this->createMock('Drupal\Core\Ajax\CommandInterface');
+ $command->expects($this->once())
+ ->method('render')
+ ->willReturn(['command' => $command_name]);
+
+ return $command;
+ }
+
}
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerLazyUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerLazyUnitTest.php
index 798735a2c8a..9dc1a0d113e 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerLazyUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionOptimizerLazyUnitTest.php
@@ -148,4 +148,40 @@ class CssCollectionOptimizerLazyUnitTest extends UnitTestCase {
self::assertStringEqualsFile(__DIR__ . '/css_test_files/css_license.css.optimized.aggregated.css', $aggregate);
}
+ /**
+ * Test that external minified CSS assets do not trigger optimization.
+ *
+ * This ensures that fully external asset groups do not result in a
+ * CssOptimizer exception and are safely ignored.
+ */
+ public function testExternalMinifiedCssAssetOptimizationIsSkipped(): void {
+ $mock_grouper = $this->createMock(AssetCollectionGrouperInterface::class);
+ $mock_optimizer = $this->createMock(AssetOptimizerInterface::class);
+ $mock_optimizer->expects($this->never())->method('optimize');
+
+ $optimizer = new CssCollectionOptimizerLazy(
+ $mock_grouper,
+ $mock_optimizer,
+ $this->createMock(ThemeManagerInterface::class),
+ $this->createMock(LibraryDependencyResolverInterface::class),
+ new RequestStack(),
+ $this->createMock(FileSystemInterface::class),
+ $this->createMock(ConfigFactoryInterface::class),
+ $this->createMock(FileUrlGeneratorInterface::class),
+ $this->createMock(TimeInterface::class),
+ $this->createMock(LanguageManagerInterface::class)
+ );
+ $optimizer->optimizeGroup([
+ 'items' => [
+ [
+ 'type' => 'external',
+ 'data' => __DIR__ . '/css_test_files/css_external.optimized.aggregated.css',
+ 'license' => FALSE,
+ 'preprocess' => TRUE,
+ 'minified' => TRUE,
+ ],
+ ],
+ ]);
+ }
+
}
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
index 7a75824bef4..0b26b97aae5 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionRendererUnitTest.php
@@ -117,7 +117,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase {
0 => ['group' => 0, 'type' => 'file', 'media' => 'all', 'preprocess' => TRUE, 'data' => 'public://css/file-all'],
],
[
- 0 => $create_link_element('generated-relative-url:public://css/file-all' . '?', 'all'),
+ 0 => $create_link_element('generated-relative-url:public://css/file-all?', 'all'),
],
],
// Single file CSS asset with custom attributes.
@@ -126,7 +126,7 @@ class CssCollectionRendererUnitTest extends UnitTestCase {
0 => ['group' => 0, 'type' => 'file', 'media' => 'all', 'preprocess' => TRUE, 'data' => 'public://css/file-all', 'attributes' => $custom_attributes],
],
[
- 0 => $create_link_element('generated-relative-url:public://css/file-all' . '?', 'all', $custom_attributes),
+ 0 => $create_link_element('generated-relative-url:public://css/file-all?', 'all', $custom_attributes),
],
],
// 31 file CSS assets: expect 31 link elements.
@@ -165,37 +165,37 @@ class CssCollectionRendererUnitTest extends UnitTestCase {
30 => $create_file_css_asset('public://css/31.css'),
],
[
- 0 => $create_link_element('generated-relative-url:public://css/1.css' . '?'),
- 1 => $create_link_element('generated-relative-url:public://css/2.css' . '?'),
- 2 => $create_link_element('generated-relative-url:public://css/3.css' . '?'),
- 3 => $create_link_element('generated-relative-url:public://css/4.css' . '?'),
- 4 => $create_link_element('generated-relative-url:public://css/5.css' . '?'),
- 5 => $create_link_element('generated-relative-url:public://css/6.css' . '?'),
- 6 => $create_link_element('generated-relative-url:public://css/7.css' . '?'),
- 7 => $create_link_element('generated-relative-url:public://css/8.css' . '?'),
- 8 => $create_link_element('generated-relative-url:public://css/9.css' . '?'),
- 9 => $create_link_element('generated-relative-url:public://css/10.css' . '?'),
- 10 => $create_link_element('generated-relative-url:public://css/11.css' . '?'),
- 11 => $create_link_element('generated-relative-url:public://css/12.css' . '?'),
- 12 => $create_link_element('generated-relative-url:public://css/13.css' . '?'),
- 13 => $create_link_element('generated-relative-url:public://css/14.css' . '?'),
- 14 => $create_link_element('generated-relative-url:public://css/15.css' . '?'),
- 15 => $create_link_element('generated-relative-url:public://css/16.css' . '?'),
- 16 => $create_link_element('generated-relative-url:public://css/17.css' . '?'),
- 17 => $create_link_element('generated-relative-url:public://css/18.css' . '?'),
- 18 => $create_link_element('generated-relative-url:public://css/19.css' . '?'),
- 19 => $create_link_element('generated-relative-url:public://css/20.css' . '?'),
- 20 => $create_link_element('generated-relative-url:public://css/21.css' . '?'),
- 21 => $create_link_element('generated-relative-url:public://css/22.css' . '?'),
- 22 => $create_link_element('generated-relative-url:public://css/23.css' . '?'),
- 23 => $create_link_element('generated-relative-url:public://css/24.css' . '?'),
- 24 => $create_link_element('generated-relative-url:public://css/25.css' . '?'),
- 25 => $create_link_element('generated-relative-url:public://css/26.css' . '?'),
- 26 => $create_link_element('generated-relative-url:public://css/27.css' . '?'),
- 27 => $create_link_element('generated-relative-url:public://css/28.css' . '?'),
- 28 => $create_link_element('generated-relative-url:public://css/29.css' . '?'),
- 29 => $create_link_element('generated-relative-url:public://css/30.css' . '?'),
- 30 => $create_link_element('generated-relative-url:public://css/31.css' . '?'),
+ 0 => $create_link_element('generated-relative-url:public://css/1.css?'),
+ 1 => $create_link_element('generated-relative-url:public://css/2.css?'),
+ 2 => $create_link_element('generated-relative-url:public://css/3.css?'),
+ 3 => $create_link_element('generated-relative-url:public://css/4.css?'),
+ 4 => $create_link_element('generated-relative-url:public://css/5.css?'),
+ 5 => $create_link_element('generated-relative-url:public://css/6.css?'),
+ 6 => $create_link_element('generated-relative-url:public://css/7.css?'),
+ 7 => $create_link_element('generated-relative-url:public://css/8.css?'),
+ 8 => $create_link_element('generated-relative-url:public://css/9.css?'),
+ 9 => $create_link_element('generated-relative-url:public://css/10.css?'),
+ 10 => $create_link_element('generated-relative-url:public://css/11.css?'),
+ 11 => $create_link_element('generated-relative-url:public://css/12.css?'),
+ 12 => $create_link_element('generated-relative-url:public://css/13.css?'),
+ 13 => $create_link_element('generated-relative-url:public://css/14.css?'),
+ 14 => $create_link_element('generated-relative-url:public://css/15.css?'),
+ 15 => $create_link_element('generated-relative-url:public://css/16.css?'),
+ 16 => $create_link_element('generated-relative-url:public://css/17.css?'),
+ 17 => $create_link_element('generated-relative-url:public://css/18.css?'),
+ 18 => $create_link_element('generated-relative-url:public://css/19.css?'),
+ 19 => $create_link_element('generated-relative-url:public://css/20.css?'),
+ 20 => $create_link_element('generated-relative-url:public://css/21.css?'),
+ 21 => $create_link_element('generated-relative-url:public://css/22.css?'),
+ 22 => $create_link_element('generated-relative-url:public://css/23.css?'),
+ 23 => $create_link_element('generated-relative-url:public://css/24.css?'),
+ 24 => $create_link_element('generated-relative-url:public://css/25.css?'),
+ 25 => $create_link_element('generated-relative-url:public://css/26.css?'),
+ 26 => $create_link_element('generated-relative-url:public://css/27.css?'),
+ 27 => $create_link_element('generated-relative-url:public://css/28.css?'),
+ 28 => $create_link_element('generated-relative-url:public://css/29.css?'),
+ 29 => $create_link_element('generated-relative-url:public://css/30.css?'),
+ 30 => $create_link_element('generated-relative-url:public://css/31.css?'),
],
],
// 32 file CSS assets with the same properties, except for the 10th and
@@ -236,38 +236,38 @@ class CssCollectionRendererUnitTest extends UnitTestCase {
31 => $create_file_css_asset('public://css/32.css'),
],
[
- 0 => $create_link_element('generated-relative-url:public://css/1.css' . '?'),
- 1 => $create_link_element('generated-relative-url:public://css/2.css' . '?'),
- 2 => $create_link_element('generated-relative-url:public://css/3.css' . '?'),
- 3 => $create_link_element('generated-relative-url:public://css/4.css' . '?'),
- 4 => $create_link_element('generated-relative-url:public://css/5.css' . '?'),
- 5 => $create_link_element('generated-relative-url:public://css/6.css' . '?'),
- 6 => $create_link_element('generated-relative-url:public://css/7.css' . '?'),
- 7 => $create_link_element('generated-relative-url:public://css/8.css' . '?'),
- 8 => $create_link_element('generated-relative-url:public://css/9.css' . '?'),
- 9 => $create_link_element('generated-relative-url:public://css/10.css' . '?', 'screen'),
- 10 => $create_link_element('generated-relative-url:public://css/11.css' . '?'),
- 11 => $create_link_element('generated-relative-url:public://css/12.css' . '?'),
- 12 => $create_link_element('generated-relative-url:public://css/13.css' . '?'),
- 13 => $create_link_element('generated-relative-url:public://css/14.css' . '?'),
- 14 => $create_link_element('generated-relative-url:public://css/15.css' . '?'),
- 15 => $create_link_element('generated-relative-url:public://css/16.css' . '?'),
- 16 => $create_link_element('generated-relative-url:public://css/17.css' . '?'),
- 17 => $create_link_element('generated-relative-url:public://css/18.css' . '?'),
- 18 => $create_link_element('generated-relative-url:public://css/19.css' . '?'),
- 19 => $create_link_element('generated-relative-url:public://css/20.css' . '?', 'print'),
- 20 => $create_link_element('generated-relative-url:public://css/21.css' . '?'),
- 21 => $create_link_element('generated-relative-url:public://css/22.css' . '?'),
- 22 => $create_link_element('generated-relative-url:public://css/23.css' . '?'),
- 23 => $create_link_element('generated-relative-url:public://css/24.css' . '?'),
- 24 => $create_link_element('generated-relative-url:public://css/25.css' . '?'),
- 25 => $create_link_element('generated-relative-url:public://css/26.css' . '?'),
- 26 => $create_link_element('generated-relative-url:public://css/27.css' . '?'),
- 27 => $create_link_element('generated-relative-url:public://css/28.css' . '?'),
- 28 => $create_link_element('generated-relative-url:public://css/29.css' . '?'),
- 29 => $create_link_element('generated-relative-url:public://css/30.css' . '?'),
- 30 => $create_link_element('generated-relative-url:public://css/31.css' . '?'),
- 31 => $create_link_element('generated-relative-url:public://css/32.css' . '?'),
+ 0 => $create_link_element('generated-relative-url:public://css/1.css?'),
+ 1 => $create_link_element('generated-relative-url:public://css/2.css?'),
+ 2 => $create_link_element('generated-relative-url:public://css/3.css?'),
+ 3 => $create_link_element('generated-relative-url:public://css/4.css?'),
+ 4 => $create_link_element('generated-relative-url:public://css/5.css?'),
+ 5 => $create_link_element('generated-relative-url:public://css/6.css?'),
+ 6 => $create_link_element('generated-relative-url:public://css/7.css?'),
+ 7 => $create_link_element('generated-relative-url:public://css/8.css?'),
+ 8 => $create_link_element('generated-relative-url:public://css/9.css?'),
+ 9 => $create_link_element('generated-relative-url:public://css/10.css?', 'screen'),
+ 10 => $create_link_element('generated-relative-url:public://css/11.css?'),
+ 11 => $create_link_element('generated-relative-url:public://css/12.css?'),
+ 12 => $create_link_element('generated-relative-url:public://css/13.css?'),
+ 13 => $create_link_element('generated-relative-url:public://css/14.css?'),
+ 14 => $create_link_element('generated-relative-url:public://css/15.css?'),
+ 15 => $create_link_element('generated-relative-url:public://css/16.css?'),
+ 16 => $create_link_element('generated-relative-url:public://css/17.css?'),
+ 17 => $create_link_element('generated-relative-url:public://css/18.css?'),
+ 18 => $create_link_element('generated-relative-url:public://css/19.css?'),
+ 19 => $create_link_element('generated-relative-url:public://css/20.css?', 'print'),
+ 20 => $create_link_element('generated-relative-url:public://css/21.css?'),
+ 21 => $create_link_element('generated-relative-url:public://css/22.css?'),
+ 22 => $create_link_element('generated-relative-url:public://css/23.css?'),
+ 23 => $create_link_element('generated-relative-url:public://css/24.css?'),
+ 24 => $create_link_element('generated-relative-url:public://css/25.css?'),
+ 25 => $create_link_element('generated-relative-url:public://css/26.css?'),
+ 26 => $create_link_element('generated-relative-url:public://css/27.css?'),
+ 27 => $create_link_element('generated-relative-url:public://css/28.css?'),
+ 28 => $create_link_element('generated-relative-url:public://css/29.css?'),
+ 29 => $create_link_element('generated-relative-url:public://css/30.css?'),
+ 30 => $create_link_element('generated-relative-url:public://css/31.css?'),
+ 31 => $create_link_element('generated-relative-url:public://css/32.css?'),
],
],
];
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
index 6b8df5044f2..9db6abea52c 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
@@ -87,7 +87,8 @@ class LibraryDiscoveryTest extends UnitTestCase {
* Tests getting a deprecated library.
*/
public function testAssetLibraryDeprecation(): void {
- $previous_error_handler = set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
+ $previous_error_handler = get_error_handler();
+ set_error_handler(function ($severity, $message, $file, $line) use (&$previous_error_handler) {
// Convert deprecation error into a catchable exception.
if ($severity === E_USER_DEPRECATED) {
throw new \ErrorException($message, 0, $severity, $file, $line);
diff --git a/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_external.optimized.aggregated.css b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_external.optimized.aggregated.css
new file mode 100644
index 00000000000..dac82b6b80f
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Asset/css_test_files/css_external.optimized.aggregated.css
@@ -0,0 +1 @@
+/* Placeholder external CSS file. */
diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
index e313731c9eb..a0f6447554d 100644
--- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
@@ -449,7 +449,7 @@ class ConfigTest extends UnitTestCase {
'Config object name ' . str_repeat('a', Config::MAX_NAME_LENGTH) . '. exceeds maximum allowed length of ' . Config::MAX_NAME_LENGTH . ' characters.',
],
];
- // Name must not contain : ? * < > " ' / \
+ // Name must not contain ":", "?", "*", "<", ">", """, "'", "/", or "\".
foreach ([':', '?', '*', '<', '>', '"', "'", '/', '\\'] as $char) {
$name = 'name.' . $char;
$return[] = [
diff --git a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php
index 7ecc4518d71..569a6e3fd18 100644
--- a/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/RowCountExceptionTest.php
@@ -27,7 +27,7 @@ class RowCountExceptionTest extends UnitTestCase {
*/
public static function providerTestExceptionMessage() {
return [
- [static::DEFAULT_EXCEPTION_MESSAGE, ''],
+ [self::DEFAULT_EXCEPTION_MESSAGE, ''],
['test', 'test'],
];
}
@@ -47,7 +47,7 @@ class RowCountExceptionTest extends UnitTestCase {
*/
public function testExceptionMessageNull(): void {
$e = new RowCountException(NULL);
- $this->assertSame(static::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage());
+ $this->assertSame(self::DEFAULT_EXCEPTION_MESSAGE, $e->getMessage());
}
}
diff --git a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
index e36767d2f5a..c74090fb599 100644
--- a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
@@ -7,6 +7,7 @@ namespace Drupal\Tests\Core\Database;
use Drupal\Core\Database\Database;
use Drupal\Core\Extension\Exception\UnknownExtensionException;
use Drupal\Tests\UnitTestCase;
+use PHPUnit\Framework\Attributes\IgnoreDeprecations;
// cspell:ignore dummydb
@@ -31,7 +32,7 @@ class UrlConversionTest extends UnitTestCase {
* @dataProvider providerConvertDbUrlToConnectionInfo
*/
public function testDbUrlToConnectionConversion($url, $database_array, $include_test_drivers): void {
- $result = Database::convertDbUrlToConnectionInfo($url, $this->root, $include_test_drivers);
+ $result = Database::convertDbUrlToConnectionInfo($url, $include_test_drivers);
$this->assertEquals($database_array, $result);
}
@@ -279,10 +280,10 @@ class UrlConversionTest extends UnitTestCase {
*
* @dataProvider providerInvalidArgumentsUrlConversion
*/
- public function testGetInvalidArgumentExceptionInUrlConversion($url, $root, $expected_exception_message): void {
+ public function testGetInvalidArgumentExceptionInUrlConversion($url, $expected_exception_message): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage($expected_exception_message);
- Database::convertDbUrlToConnectionInfo($url, $root);
+ Database::convertDbUrlToConnectionInfo($url);
}
/**
@@ -291,14 +292,12 @@ class UrlConversionTest extends UnitTestCase {
* @return array
* Array of arrays with the following elements:
* - An invalid URL string.
- * - Drupal root string.
* - The expected exception message.
*/
public static function providerInvalidArgumentsUrlConversion() {
return [
- ['foo', '', "Missing scheme in URL 'foo'"],
- ['foo', 'bar', "Missing scheme in URL 'foo'"],
- ['foo/bar/baz', 'bar2', "Missing scheme in URL 'foo/bar/baz'"],
+ ['foo', "Missing scheme in URL 'foo'"],
+ ['foo/bar/baz', "Missing scheme in URL 'foo/bar/baz'"],
];
}
@@ -307,7 +306,7 @@ class UrlConversionTest extends UnitTestCase {
*/
public function testNoModuleSpecifiedDefaultsToDriverName(): void {
$url = 'dummydb://test_user:test_pass@test_host/test_database';
- $connection_info = Database::convertDbUrlToConnectionInfo($url, $this->root, TRUE);
+ $connection_info = Database::convertDbUrlToConnectionInfo($url, TRUE);
$expected = [
'driver' => 'dummydb',
'username' => 'test_user',
@@ -518,7 +517,7 @@ class UrlConversionTest extends UnitTestCase {
$url = 'foo_bar_mysql://test_user:test_pass@test_host:3306/test_database?module=foo_bar';
$this->expectException(UnknownExtensionException::class);
$this->expectExceptionMessage("The database_driver Drupal\\foo_bar\\Driver\\Database\\foo_bar_mysql does not exist.");
- Database::convertDbUrlToConnectionInfo($url, $this->root, TRUE);
+ Database::convertDbUrlToConnectionInfo($url, TRUE);
}
/**
@@ -528,7 +527,16 @@ class UrlConversionTest extends UnitTestCase {
$url = 'driver_test_mysql://test_user:test_pass@test_host:3306/test_database?module=driver_test';
$this->expectException(UnknownExtensionException::class);
$this->expectExceptionMessage("The database_driver Drupal\\driver_test\\Driver\\Database\\driver_test_mysql does not exist.");
- Database::convertDbUrlToConnectionInfo($url, $this->root, TRUE);
+ Database::convertDbUrlToConnectionInfo($url, TRUE);
+ }
+
+ /**
+ * @covers ::convertDbUrlToConnectionInfo
+ */
+ #[IgnoreDeprecations]
+ public function testDeprecationOfRootParameter(): void {
+ $this->expectDeprecation('Passing a string $root value to Drupal\\Core\\Database\\Database::convertDbUrlToConnectionInfo() is deprecated in drupal:11.3.0 and will be removed in drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3511287');
+ Database::convertDbUrlToConnectionInfo('sqlite://localhost/test_database', $this->root, TRUE);
}
}
diff --git a/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php b/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php
index ad6f98c3cf7..bd64798d240 100644
--- a/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php
+++ b/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php
@@ -19,18 +19,55 @@ class FinderTest extends UnitTestCase {
*/
public function testFoundDataIsInDependencyOrder(): void {
$finder = new Finder(__DIR__ . '/../../../../fixtures/default_content');
+ $actual_order = array_keys($finder->data);
- $expected_order = [
- // First is the author of the node.
- '94503467-be7f-406c-9795-fc25baa22203',
- // Next, the taxonomy term referenced by the node.
- '550f86ad-aa11-4047-953f-636d42889f85',
- // Then we have the node itself, since it has no other dependencies.
- 'e1714f23-70c0-4493-8e92-af1901771921',
- // Finally, the menu link to the node.
- '3434bd5a-d2cd-4f26-bf79-a7f6b951a21b',
- ];
- $this->assertSame($expected_order, array_slice(array_keys($finder->data), 0, 4));
+ $node_uuid = 'e1714f23-70c0-4493-8e92-af1901771921';
+ // The author of the node should come before the node itself. We're using
+ // named arguments here purely for clarity.
+ $this->assertRelativeOrder(
+ $actual_order,
+ earlier: '94503467-be7f-406c-9795-fc25baa22203',
+ later: $node_uuid,
+ );
+ // Same with the taxonomy term referenced by the node.
+ $this->assertRelativeOrder(
+ $actual_order,
+ earlier: '550f86ad-aa11-4047-953f-636d42889f85',
+ later: $node_uuid,
+ );
+ // The menu link to the node should come after the node.
+ $this->assertRelativeOrder(
+ $actual_order,
+ earlier: $node_uuid,
+ later: '3434bd5a-d2cd-4f26-bf79-a7f6b951a21b',
+ );
+
+ // A node that is in a workspace should come after the workspace itself.
+ $this->assertRelativeOrder(
+ $actual_order,
+ earlier: '384c4c10-cc41-4d7e-a1cc-85d1cdc9e87d',
+ later: '48475954-e878-439c-9d3d-226724a44269',
+ );
+ }
+
+ /**
+ * Asserts that an item in an array comes before another item in that array.
+ *
+ * @param array $haystack
+ * The array to examine.
+ * @param mixed $earlier
+ * The item which should come first.
+ * @param mixed $later
+ * The item which should come after.
+ */
+ private function assertRelativeOrder(array $haystack, mixed $earlier, mixed $later): void {
+ $haystack = array_values($haystack);
+ $earlier_index = array_search($earlier, $haystack, TRUE);
+ $later_index = array_search($later, $haystack, TRUE);
+ $this->assertIsInt($earlier_index);
+ $this->assertIsInt($later_index);
+ // "Later" should be greater than "earlier".
+ $this->assertGreaterThan($earlier_index, $later_index);
}
/**
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
index c910a3c99c7..7af0c490d07 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
@@ -4,8 +4,10 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\DependencyInjection\Compiler;
+use Drupal\Core\Database\Connection;
use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass;
use Drupal\Tests\UnitTestCase;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
@@ -92,6 +94,16 @@ class BackendCompilerPassTest extends UnitTestCase {
$container->setDefinition('DriverTestMysql.service', new Definition(__NAMESPACE__ . '\\ServiceClassDriverTestMysql'));
$this->backendPass->process($container);
$this->assertEquals($prefix . 'DriverTestMysql', get_class($container->get('service')));
+
+ // Verify that if the container has a default_backend parameter,
+ // and there is a service named ".my-service", the right alias is created.
+ $container = $this->getMockDriverContainerWithDefaultBackendParameterArgumentAndDotPrefixedService();
+ $this->backendPass->process($container);
+
+ // Verify that if the db service returns no driver, no invalid aliases are
+ // created.
+ $container = $this->getMockDriverContainerWithNullDriverBackend();
+ $this->backendPass->process($container);
}
/**
@@ -154,6 +166,82 @@ class BackendCompilerPassTest extends UnitTestCase {
return $container;
}
+ /**
+ * Creates a container with a database mock definition in it.
+ *
+ * This mock won't declare a driver nor databaseType to ensure no invalid
+ * aliases are set.
+ *
+ * @return \Symfony\Component\DependencyInjection\ContainerBuilder
+ * The container with a mock database service in it.
+ */
+ protected function getMockDriverContainerWithNullDriverBackend(): ContainerBuilder&MockObject {
+ $container = $this->getMockBuilder(ContainerBuilder::class)->getMock();
+ $mock = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
+ $mock->expects($this->once())
+ ->method('driver')
+ ->willReturn(NULL);
+ $mock->expects($this->once())
+ ->method('databaseType')
+ ->willReturn(NULL);
+ $container->expects($this->any())
+ ->method('get')
+ ->with('database')
+ ->willReturn($mock);
+ $container->expects($this->once())
+ ->method('findTaggedServiceIds')
+ ->willReturn(['fakeService' => ['class' => 'fakeServiceClass']]);
+ $container->expects($this->never())
+ ->method('hasDefinition')
+ ->with('.fakeService')
+ ->willReturn(TRUE);
+ $container->expects($this->never())
+ ->method('setAlias');
+ return $container;
+ }
+
+ /**
+ * Creates a container with a database mock definition in it.
+ *
+ * This mock container has a default_backend parameter and a dot-prefixed
+ * service to verify the right aliases are set.
+ *
+ * @return \Symfony\Component\DependencyInjection\ContainerBuilder
+ * The container with a mock database service in it.
+ */
+ protected function getMockDriverContainerWithDefaultBackendParameterArgumentAndDotPrefixedService(): ContainerBuilder&MockObject {
+ $container = $this->getMockBuilder(ContainerBuilder::class)->getMock();
+ $container->expects($this->once())
+ ->method('hasParameter')
+ ->with('default_backend')
+ ->willReturn(TRUE);
+ $container->expects($this->once())
+ ->method('getParameter')
+ ->with('default_backend')
+ ->willReturn('a_valid_default_backend');
+
+ $mock = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
+ $mock->expects($this->never())
+ ->method('driver');
+ $mock->expects($this->never())
+ ->method('databaseType');
+ $container->expects($this->any())
+ ->method('get')
+ ->with('database')
+ ->willReturn($mock);
+ $container->expects($this->once())
+ ->method('findTaggedServiceIds')
+ ->willReturn(['fakeService' => ['class' => 'fakeServiceClass']]);
+ $container->expects($this->once())
+ ->method('hasDefinition')
+ ->with('a_valid_default_backend.fakeService')
+ ->willReturn(TRUE);
+ $container->expects($this->once())
+ ->method('setAlias')
+ ->with('fakeService', new Alias('a_valid_default_backend.fakeService'));
+ return $container;
+ }
+
}
/**
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
index df504f4b726..cdfb897046c 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/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 2e8125f331d..e99ce613883 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -660,7 +660,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
* @covers ::set
*/
public function testSet(): void {
- // Exercise set(), check if it returns $this
+ // Exercise set(), check if it returns $this.
$this->assertSame(
$this->entity,
$this->entity->set('id', 0)
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
index af2743a8072..4bb5c1f1ec3 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
@@ -280,7 +280,7 @@ class EntityFieldManagerTest extends UnitTestCase {
$this->assertSame($expected, $this->entityFieldManager->getFieldDefinitions('test_entity_type', 'test_entity_bundle'));
// Test that base fields and bundle fields from the bundle class and
- // entity class are retrieved
+ // entity class are retrieved.
$expected = [
'id' => $field_definition,
'some_extra_field' => $bundle_fields['the_entity_id']['test_entity_bundle_class']['some_extra_field'],
@@ -620,11 +620,11 @@ class EntityFieldManagerTest extends UnitTestCase {
$storage->loadMultiple(Argument::type('array'))->willReturn([]);
// By default, make the storage entity class lookup return the
- // EntityTypeManagerTestEntity class
+ // EntityTypeManagerTestEntity class.
$storage->getEntityClass(NULL)->willReturn(EntityTypeManagerTestEntity::class);
$storage->getEntityClass(Argument::type('string'))->willReturn(EntityTypeManagerTestEntity::class);
// When using the "test_entity_bundle_class" bundle, return the
- // EntityTypeManagerTestEntityBundle class
+ // EntityTypeManagerTestEntityBundle class.
$storage->getEntityClass('test_entity_bundle_class')->willReturn(EntityTypeManagerTestEntityBundle::class);
$this->entityTypeManager->getStorage('test_entity_type')->willReturn($storage->reveal());
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityViewBuilderTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityViewBuilderTest.php
new file mode 100644
index 00000000000..29d3d17dba0
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityViewBuilderTest.php
@@ -0,0 +1,80 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Entity;
+
+use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
+use Drupal\Core\Entity\EntityViewBuilder;
+use Drupal\Core\Entity\FieldableEntityInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Entity\EntityViewBuilder
+ * @group Entity
+ */
+class EntityViewBuilderTest extends UnitTestCase {
+
+ const string ENTITY_TYPE_ID = 'test_entity_type';
+
+ /**
+ * The entity view builder under test.
+ *
+ * @var \Drupal\Core\Entity\EntityViewBuilder
+ */
+ protected EntityViewBuilder $viewBuilder;
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp(): void {
+ parent::setUp();
+ $this->viewBuilder = new class() extends EntityViewBuilder {
+
+ public function __construct() {
+ $this->entityTypeId = EntityViewBuilderTest::ENTITY_TYPE_ID;
+ }
+
+ };
+ }
+
+ /**
+ * Tests build components using a mocked Iterator.
+ */
+ public function testBuildComponents(): void {
+ $field_name = $this->randomMachineName();
+ $bundle = $this->randomMachineName();
+ $entity_id = mt_rand(20, 30);
+ $field_item_list = $this->createStub(FieldItemListInterface::class);
+ $item = new \stdClass();
+ $this->setupMockIterator($field_item_list, [$item]);
+ $entity = $this->createConfiguredStub(FieldableEntityInterface::class, [
+ 'bundle' => $bundle,
+ 'hasField' => TRUE,
+ 'get' => $field_item_list,
+ ]);
+ $formatter_result = [
+ $entity_id => ['#' . $this->randomMachineName() => $this->randomString()],
+ ];
+ $display = $this->createConfiguredStub(EntityViewDisplayInterface::class, [
+ 'getComponents' => [$field_name => []],
+ 'buildMultiple' => $formatter_result,
+ ]);
+ $entities = [$entity_id => $entity];
+ $displays = [$bundle => $display];
+ $build = [$entity_id => []];
+ $view_mode = $this->randomMachineName();
+ // Assert the hook is invoked.
+ $module_handler = $this->createMock(ModuleHandlerInterface::class);
+ $module_handler->expects($this->once())
+ ->method('invokeAll')
+ ->with('entity_prepare_view', [self::ENTITY_TYPE_ID, $entities, $displays, $view_mode]);
+ $this->viewBuilder->setModuleHandler($module_handler);
+ $this->viewBuilder->buildComponents($build, $entities, $displays, $view_mode);
+ $this->assertSame([], $item->_attributes);
+ $this->assertSame($formatter_result, $build);
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
index 2381b64b83a..9dbc2308b2d 100644
--- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
@@ -610,7 +610,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
*/
protected function getMockEntity(string $class = EntityBaseTest::class, array $arguments = [], array $methods = []): EntityInterface&MockObject {
// Ensure the entity is passed at least an array of values and an entity
- // type ID
+ // type ID.
if (!isset($arguments[0])) {
$arguments[0] = [];
}
diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php
index 5c7ad53788d..73acc7f5ade 100644
--- a/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php
@@ -357,7 +357,7 @@ class ConfigTargetTest extends UnitTestCase {
'second',
],
// In case of multiple targets, the return value must be an array with the
- // keys matching
+ // keys matching.
// @see ::testMultiTarget()
fromConfig: fn (int $first, int $second): string => "$first|$second",
toConfig: fn (): mixed => $toConfigReturnValue,
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index d7a364170f0..f2afab3f8a9 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -1002,6 +1002,57 @@ class FormBuilderTest extends FormTestBase {
];
}
+ /**
+ * Tests the detection of the triggering element.
+ */
+ public function testTriggeringElement(): void {
+ $form_arg = 'Drupal\Tests\Core\Form\TestForm';
+
+ // No triggering element.
+ $form_state = new FormState();
+ $this->formBuilder->buildForm($form_arg, $form_state);
+ $this->assertNull($form_state->getTriggeringElement());
+
+ // When no op is provided, default to the first button element.
+ $form_state = new FormState();
+ $form_state->setMethod('GET');
+ $form_state->setUserInput(['form_id' => 'test_form']);
+ $this->formBuilder->buildForm($form_arg, $form_state);
+ $triggeringElement = $form_state->getTriggeringElement();
+ $this->assertIsArray($triggeringElement);
+ $this->assertSame('op', $triggeringElement['#name']);
+ $this->assertSame('Submit', $triggeringElement['#value']);
+
+ // A single triggering element.
+ $form_state = new FormState();
+ $form_state->setMethod('GET');
+ $form_state->setUserInput(['form_id' => 'test_form', 'op' => 'Submit']);
+ $this->formBuilder->buildForm($form_arg, $form_state);
+ $triggeringElement = $form_state->getTriggeringElement();
+ $this->assertIsArray($triggeringElement);
+ $this->assertSame('op', $triggeringElement['#name']);
+
+ // A different triggering element.
+ $form_state = new FormState();
+ $form_state->setMethod('GET');
+ $form_state->setUserInput(['form_id' => 'test_form', 'other_action' => 'Other action']);
+ $this->formBuilder->buildForm($form_arg, $form_state);
+ $triggeringElement = $form_state->getTriggeringElement();
+ $this->assertIsArray($triggeringElement);
+ $this->assertSame('other_action', $triggeringElement['#name']);
+
+ // Two triggering elements.
+ $form_state = new FormState();
+ $form_state->setMethod('GET');
+ $form_state->setUserInput(['form_id' => 'test_form', 'op' => 'Submit', 'other_action' => 'Other action']);
+ $this->formBuilder->buildForm($form_arg, $form_state);
+
+ // Verify that only the first triggering element is respected.
+ $triggeringElement = $form_state->getTriggeringElement();
+ $this->assertIsArray($triggeringElement);
+ $this->assertSame('op', $triggeringElement['#name']);
+ }
+
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc b/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
index 0e34dd9110d..0e633183d33 100644
--- a/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
+++ b/core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
@@ -36,5 +36,10 @@ function test_form_id() {
'#type' => 'submit',
'#value' => 'Submit',
];
+ $form['actions']['other_action'] = [
+ '#type' => 'submit',
+ '#name' => 'other_action',
+ '#value' => 'Other action',
+ ];
return $form;
}
diff --git a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
index 887aa67098b..06629fdc6ff 100644
--- a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
@@ -53,7 +53,7 @@ class StaticMenuLinkOverridesTest extends UnitTestCase {
$data[] = [['test1' => ['parent' => 'test0']], 'test1', ['parent' => 'test0']];
// Non existing ID.
$data[] = [['test1' => ['parent' => 'test0']], 'test2', []];
- // Ensure that the ID is encoded properly
+ // Ensure that the ID is encoded properly.
$data[] = [['test1__la___ma' => ['parent' => 'test0']], 'test1.la__ma', ['parent' => 'test0']];
return $data;
diff --git a/core/tests/Drupal/Tests/Core/Plugin/ConfigurablePluginBaseTest.php b/core/tests/Drupal/Tests/Core/Plugin/ConfigurablePluginBaseTest.php
new file mode 100644
index 00000000000..d05413eb444
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Plugin/ConfigurablePluginBaseTest.php
@@ -0,0 +1,47 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Plugin;
+
+use Drupal\Core\Plugin\ConfigurablePluginBase;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Tests ConfigurablePluginBase.
+ *
+ * @group Plugin
+ *
+ * @coversDefaultClass \Drupal\Core\Plugin\ConfigurablePluginBase
+ */
+class ConfigurablePluginBaseTest extends TestCase {
+
+ /**
+ * Tests the Constructor.
+ */
+ public function testConstructor(): void {
+ $provided_configuration = [
+ 'foo' => 'bar',
+ ];
+ $merged_configuration = ['default' => 'default'] + $provided_configuration;
+ $plugin = new ConfigurablePluginBaseTestClass($provided_configuration, '', []);
+ $this->assertSame($merged_configuration, $plugin->getConfiguration());
+ }
+
+}
+
+/**
+ * Test class for ConfigurablePluginBase.
+ */
+class ConfigurablePluginBaseTestClass extends ConfigurablePluginBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function defaultConfiguration(): array {
+ return [
+ 'default' => 'default',
+ ];
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php b/core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php
new file mode 100644
index 00000000000..21543658769
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php
@@ -0,0 +1,205 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Plugin;
+
+use Drupal\Component\Plugin\ConfigurableInterface;
+use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Plugin\ConfigurableTrait;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Tests for ConfigurableTrait.
+ *
+ * @group Plugin
+ *
+ * @coversDefaultClass \Drupal\Core\Plugin\ConfigurableTrait
+ */
+class ConfigurableTraitTest extends TestCase {
+
+ /**
+ * Tests ConfigurableTrait::defaultConfiguration.
+ *
+ * @covers ::defaultConfiguration
+ */
+ public function testDefaultConfiguration(): void {
+ /** @var \Drupal\Component\Plugin\ConfigurableInterface $configurable_plugin */
+ $configurable_plugin = new ConfigurableTestClass();
+ $this->assertSame([], $configurable_plugin->defaultConfiguration());
+ }
+
+ /**
+ * Tests ConfigurableTrait::getConfiguration.
+ *
+ * @covers ::getConfiguration
+ */
+ public function testGetConfiguration(): void {
+ $test_configuration = [
+ 'config_key_1' => 'config_value_1',
+ 'config_key_2' => [
+ 'nested_key_1' => 'nested_value_1',
+ 'nested_key_2' => 'nested_value_2',
+ ],
+ ];
+ $configurable_plugin = new ConfigurableTestClass($test_configuration);
+ $this->assertSame($test_configuration, $configurable_plugin->getConfiguration());
+ }
+
+ /**
+ * Tests configurableTrait::setConfiguration.
+ *
+ * Specifically test the way default and provided configurations are merged.
+ *
+ * @param array $default_configuration
+ * The default configuration to use for the trait.
+ * @param array $test_configuration
+ * The configuration to test.
+ * @param array $final_configuration
+ * The expected final plugin configuration.
+ *
+ * @covers ::setConfiguration
+ *
+ * @dataProvider setConfigurationDataProvider
+ */
+ public function testSetConfiguration(array $default_configuration, array $test_configuration, array $final_configuration): void {
+ $test_object = new ConfigurableTestClass();
+ $test_object->setDefaultConfiguration($default_configuration);
+ $test_object->setConfiguration($test_configuration);
+ $this->assertSame($final_configuration, $test_object->getConfiguration());
+ }
+
+ /**
+ * Provides data for testSetConfiguration.
+ *
+ * @return array
+ * The data.
+ */
+ public static function setConfigurationDataProvider(): array {
+ return [
+ 'Direct Override' => [
+ 'default_configuration' => [
+ 'default_key_1' => 'default_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'default_nested_value_1',
+ 'default_nested_key_2' => 'default_nested_value_2',
+ ],
+ ],
+ 'test_configuration' => [
+ 'default_key_1' => 'override_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'override_nested_value_1',
+ 'default_nested_key_2' => 'override_nested_value_2',
+ ],
+ ],
+ 'final_configuration' => [
+ 'default_key_1' => 'override_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'override_nested_value_1',
+ 'default_nested_key_2' => 'override_nested_value_2',
+ ],
+ ],
+ ],
+ 'Mixed Override' => [
+ 'default_configuration' => [
+ 'default_key_1' => 'default_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'default_nested_value_1',
+ 'default_nested_key_2' => 'default_nested_value_2',
+ ],
+ ],
+ 'test_configuration' => [
+ 'override_key_1' => 'config_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'override_value_1',
+ 'override_nested_key' => 'override_value',
+ ],
+ ],
+ 'final_configuration' => [
+ 'default_key_1' => 'default_value_1',
+ 'default_key_2' => [
+ 'default_nested_key_1' => 'override_value_1',
+ 'default_nested_key_2' => 'default_nested_value_2',
+ 'override_nested_key' => 'override_value',
+ ],
+ 'override_key_1' => 'config_value_1',
+ ],
+ ],
+ 'indexed_override' => [
+ 'default_configuration' => [
+ 'config_value_1',
+ 'config_value_2',
+ 'config_value_3',
+ ],
+ 'test_configuration' => [
+ 'override_value_1',
+ 'override_value_2',
+ ],
+ 'final_configuration' => [
+ 'override_value_1',
+ 'override_value_2',
+ 'config_value_3',
+ ],
+ ],
+ 'indexed_override_complex' => [
+ 'default_configuration' => [
+ 'config_value_1',
+ 'config_value_2',
+ 'config_value_3',
+ ],
+ 'test_configuration' => [
+ 0 => 'override_value_1',
+ 2 => 'override_value_3',
+ ],
+ 'final_configuration' => [
+ 'override_value_1',
+ 'config_value_2',
+ 'override_value_3',
+ ],
+ ],
+ ];
+ }
+
+}
+
+/**
+ * A test class using ConfigurablePluginTrait that can modify the de.
+ */
+class ConfigurableTestClass extends PluginBase implements ConfigurableInterface {
+ use ConfigurableTrait {
+ defaultConfiguration as traitDefaultConfiguration;
+ }
+
+ /**
+ * A default configuration for the test class to return.
+ *
+ * @var array|null
+ */
+ protected ?array $defaultConfiguration = NULL;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct(array $configuration = [], string $plugin_id = '', array $plugin_definition = []) {
+ parent::__construct($configuration, $plugin_id, $plugin_definition);
+ $this->setConfiguration($configuration);
+ }
+
+ /**
+ * Sets the default configuration this test will return.
+ *
+ * @param array $default_configuration
+ * The default configuration to use.
+ */
+ public function setDefaultConfiguration(array $default_configuration): void {
+ $this->defaultConfiguration = $default_configuration;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function defaultConfiguration(): array {
+ return $this->defaultConfiguration ?? $this->traitDefaultConfiguration();
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
index 99da7a2f974..60e147f434a 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
@@ -4,8 +4,7 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Plugin;
-use Drupal\Component\Plugin\ConfigurableInterface;
-use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Plugin\ConfigurablePluginBase;
use Drupal\Core\Plugin\DefaultSingleLazyPluginCollection;
use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
@@ -98,24 +97,5 @@ class DefaultSingleLazyPluginCollectionTest extends LazyPluginCollectionTestBase
/**
* Stub configurable plugin class for testing.
*/
-class ConfigurablePlugin extends PluginBase implements ConfigurableInterface {
-
- public function __construct(array $configuration, $plugin_id, $plugin_definition) {
- parent::__construct($configuration, $plugin_id, $plugin_definition);
-
- $this->configuration = $configuration + $this->defaultConfiguration();
- }
-
- public function defaultConfiguration() {
- return [];
- }
-
- public function getConfiguration() {
- return $this->configuration;
- }
-
- public function setConfiguration(array $configuration): void {
- $this->configuration = $configuration;
- }
-
+class ConfigurablePlugin extends ConfigurablePluginBase {
}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php b/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php
index 55695ace6de..7b72a3df453 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php
@@ -4,35 +4,13 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Plugin\Fixtures;
-use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
-use Drupal\Component\Plugin\PluginBase;
+use Drupal\Core\Plugin\ConfigurablePluginBase;
/**
* A configurable plugin implementation used for testing.
*/
-class TestConfigurablePlugin extends PluginBase implements ConfigurableInterface, DependentPluginInterface {
-
- /**
- * {@inheritdoc}
- */
- public function getConfiguration() {
- return $this->configuration;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setConfiguration(array $configuration) {
- $this->configuration = $configuration;
- }
-
- /**
- * {@inheritdoc}
- */
- public function defaultConfiguration() {
- return [];
- }
+class TestConfigurablePlugin extends ConfigurablePluginBase implements DependentPluginInterface {
/**
* {@inheritdoc}
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
index d0c09e97fc5..8490a5c0876 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/HtmlTagTest.php
@@ -6,6 +6,7 @@ namespace Drupal\Tests\Core\Render\Element;
use Drupal\Core\Render\Markup;
use Drupal\Tests\Core\Render\RendererTestBase;
+use Drupal\Core\Render\ElementInfoManagerInterface;
use Drupal\Core\Render\Element\HtmlTag;
/**
@@ -18,7 +19,7 @@ class HtmlTagTest extends RendererTestBase {
* @covers ::getInfo
*/
public function testGetInfo(): void {
- $htmlTag = new HtmlTag([], 'test', 'test');
+ $htmlTag = new HtmlTag([], 'test', 'test', elementInfoManager: $this->createStub(ElementInfoManagerInterface::class));
$info = $htmlTag->getInfo();
$this->assertArrayHasKey('#pre_render', $info);
$this->assertArrayHasKey('#attributes', $info);
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/ModernRenderElementTest.php b/core/tests/Drupal/Tests/Core/Render/Element/ModernRenderElementTest.php
new file mode 100644
index 00000000000..c91b74f8c0a
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Render/Element/ModernRenderElementTest.php
@@ -0,0 +1,60 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\Core\Render\Element;
+
+use Drupal\Component\Plugin\Factory\FactoryInterface;
+use Drupal\Core\Render\Element;
+use Drupal\Core\Render\Element\Textfield;
+use Drupal\Core\Render\ElementInfoManager;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Render\Element\RenderElementBase
+ * @group Render
+ */
+class ModernRenderElementTest extends UnitTestCase {
+
+ public function testChildren(): void {
+ $factory = $this->createMock(FactoryInterface::class);
+ $elementInfoManager = new class ($factory) extends ElementInfoManager {
+
+ public function __construct(protected $factory) {}
+
+ };
+ $factory->expects($this->any())
+ ->method('createInstance')
+ ->willReturnCallback(fn () => new Textfield([], '', NULL, $elementInfoManager));
+ // If the type is not given ::fromRenderable presumes "form" and uses the
+ // plugin discovery to find which class provides the form element. This
+ // test does not set up discovery so some type must be provided.
+ $element = ['#type' => 'ignored by the mock factory'];
+ $elementObject = $elementInfoManager->fromRenderable($element);
+ for ($i = 0; $i <= 2; $i++) {
+ $child = [
+ '#type' => 'ignored by the mock factory',
+ '#test' => $i,
+ ];
+ $elementObject->addChild("test$i", $child);
+ // addChild() takes the $child render array by reference and stores a
+ // reference to it in the render object. To avoid modifying the
+ // previously created render object when reusing the $child variable,
+ // unset() it to break the reference before reassigning.
+ unset($child);
+ }
+ foreach ([1 => ['test0', 'test1', 'test2'], 2 => ['test0', 'test2']] as $delta => $expectedChildrenKeys) {
+ $i = 0;
+ foreach ($elementObject->getChildren() as $name => $child) {
+ $this->assertSame($name, "test$i");
+ $this->assertSame($i, $child->test);
+ $i += $delta;
+ }
+ $this->assertSame(Element::children($elementObject->toRenderable()), $expectedChildrenKeys);
+ // The first iteration tests removing an existing child. The second
+ // iteration tests removing a nonexistent child.
+ $elementObject->removeChild('test1');
+ }
+ }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
index fc58c1db4ef..7acfef4ca50 100644
--- a/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Element/TableSelectTest.php
@@ -7,6 +7,7 @@ namespace Drupal\Tests\Core\Render\Element;
use Drupal\Core\Form\FormState;
use Drupal\Core\Link;
use Drupal\Core\Render\Element\Tableselect;
+use Drupal\Core\Render\ElementInfoManagerInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
@@ -25,7 +26,7 @@ class TableSelectTest extends UnitTestCase {
$form_state = new FormState();
$complete_form = [];
- $element_object = new Tableselect([], 'table_select', []);
+ $element_object = new Tableselect([], 'table_select', [], elementInfoManager: $this->createStub(ElementInfoManagerInterface::class));
$info = $element_object->getInfo();
$element += $info;
@@ -50,7 +51,7 @@ class TableSelectTest extends UnitTestCase {
$form_state = new FormState();
$complete_form = [];
- $element_object = new Tableselect([], 'table_select', []);
+ $element_object = new Tableselect([], 'table_select', [], elementInfoManager: $this->createStub(ElementInfoManagerInterface::class));
$info = $element_object->getInfo();
$element += $info;
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
index 91e21361a0f..6685372e507 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
@@ -535,7 +535,7 @@ class RendererBubblingTest extends RendererTestBase {
$this->setUpRequest();
$this->setUpMemoryCache();
- // Ensure a logic exception
+ // Ensure a logic exception.
$data = [
'#cache' => [
'keys' => ['llama', 'bar'],
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
index 2b897fe40a1..78f2f60e62a 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
@@ -78,7 +78,7 @@ class RendererPlaceholdersTest extends RendererTestBase {
// \Drupal\Core\Render\Markup::create() is necessary as the render
// system would mangle this markup. As this is exactly what happens at
// runtime this is a valid use-case.
- return Markup::create('<drupal-render-placeholder callback="Drupal\Tests\Core\Render\PlaceholdersTest::callback" arguments="' . '0=' . $args[0] . '" token="' . $token . '"></drupal-render-placeholder>');
+ return Markup::create('<drupal-render-placeholder callback="Drupal\Tests\Core\Render\PlaceholdersTest::callback" arguments="0=' . $args[0] . '" token="' . $token . '"></drupal-render-placeholder>');
};
$extract_placeholder_render_array = function ($placeholder_render_array) {
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTest.php b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
index 69301eae9bb..e4fbfa60caf 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTest.php
@@ -1097,7 +1097,7 @@ class RendererTest extends RendererTestBase {
'max-age' => 600,
],
],
- new \stdClass(),
+ (new CacheableMetadata())->setCacheMaxAge(0),
[
'#cache' => [
'contexts' => ['theme'],
@@ -1126,6 +1126,68 @@ class RendererTest extends RendererTestBase {
$this->assertFalse($this->renderer->hasRenderContext());
}
+ /**
+ * @covers ::executeInRenderContext
+ */
+ public function testExecuteInRenderContext(): void {
+ $return = $this->renderer->executeInRenderContext(new RenderContext(), function () {
+ $fiber_callback = function () {
+
+ // Create a #pre_render callback that renders a render array in
+ // isolation. This has its own #pre_render callback that calls
+ // Fiber::suspend(). This ensures that suspending a Fiber within
+ // multiple nested calls to ::executeInRenderContext() doesn't
+ // allow render context to get out of sync. This simulates similar
+ // conditions to BigPipe placeholder rendering.
+ $fiber_suspend_pre_render = function ($elements) {
+ $fiber_suspend = function ($elements) {
+ \Fiber::suspend();
+ return $elements;
+ };
+ $build = [
+ 'foo' => [
+ '#markup' => 'foo',
+ '#pre_render' => [$fiber_suspend],
+ ],
+ ];
+ $markup = $this->renderer->renderInIsolation($build);
+ $elements['#markup'] = $markup;
+ return $elements;
+ };
+ $build = [
+ 'foo' => [
+ '#pre_render' => [$fiber_suspend_pre_render],
+ ],
+ ];
+ return $this->renderer->render($build);
+ };
+
+ // Build an array of two fibers that executes the code defined above. This
+ // ensures that Fiber::suspend() is called from within two
+ // ::renderInIsolation() calls without either having been completed.
+ $fibers = [];
+ foreach ([0, 1] as $key) {
+ $fibers[] = new \Fiber(static fn () => $fiber_callback());
+ }
+ while ($fibers) {
+ foreach ($fibers as $key => $fiber) {
+ if ($fiber->isTerminated()) {
+ unset($fibers[$key]);
+ continue;
+ }
+ if ($fiber->isSuspended()) {
+ $fiber->resume();
+ }
+ else {
+ $fiber->start();
+ }
+ }
+ }
+ return $fiber->getReturn();
+ });
+ $this->assertEquals(Markup::create('foo'), $return);
+ }
+
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
index 60a7e0c9573..f19eb9541e9 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
@@ -104,7 +104,7 @@ class RedirectDestinationTest extends UnitTestCase {
// A request with a destination query.
$data[] = [$request, '/example'];
- // A request without a destination query,
+ // A request without a destination query.
$request = Request::create('/');
$data[] = [$request, '/current-path'];
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php
index 8f597af977f..3a3287c357a 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php
@@ -51,15 +51,15 @@ class ByteSizeMarkupTest extends UnitTestCase {
['1 ZB', pow($kb, 7)],
['1 YB', pow($kb, 8)],
['1024 YB', pow($kb, 9)],
- // Rounded to 1 MB - not 1000 or 1024 kilobytes
+ // Rounded to 1 MB - not 1000 or 1024 kilobytes.
['1 MB', ($kb * $kb) - 1],
['-1 MB', -(($kb * $kb) - 1)],
- // Decimal Megabytes
+ // Decimal Megabytes.
['3.46 MB', 3623651],
['3.77 GB', 4053371676],
- // Decimal Petabytes
+ // Decimal Petabytes.
['59.72 PB', 67234178751368124],
- // Decimal Yottabytes
+ // Decimal Yottabytes.
['194.67 YB', 235346823821125814962843827],
];
}
diff --git a/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php b/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php
index 43ff47406ec..d1a043446f8 100644
--- a/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php
@@ -25,7 +25,7 @@ class BrowserTestBaseTest extends UnitTestCase {
->method('getDriver')
->willReturn($driver);
- $btb = $this->getMockBuilder(BrowserTestBaseMockableClass::class)
+ $btb = $this->getMockBuilder(BrowserTestBaseMockableClassTest::class)
->disableOriginalConstructor()
->onlyMethods(['getSession'])
->getMock();
@@ -82,7 +82,7 @@ class BrowserTestBaseTest extends UnitTestCase {
public function testTearDownWithoutSetUp(): void {
$method = 'cleanupEnvironment';
$this->assertTrue(method_exists(BrowserTestBase::class, $method));
- $btb = $this->getMockBuilder(BrowserTestBaseMockableClass::class)
+ $btb = $this->getMockBuilder(BrowserTestBaseMockableClassTest::class)
->disableOriginalConstructor()
->onlyMethods([$method])
->getMock();
@@ -96,6 +96,6 @@ class BrowserTestBaseTest extends UnitTestCase {
/**
* A class extending BrowserTestBase for testing purposes.
*/
-class BrowserTestBaseMockableClass extends BrowserTestBase {
+class BrowserTestBaseMockableClassTest extends BrowserTestBase {
}
diff --git a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php
index ba1d28a50c6..5627d068aa7 100644
--- a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php
@@ -29,7 +29,7 @@ class TestSetupTraitTest extends UnitTestCase {
public function testChangeDatabasePrefix(): void {
$root = dirname(__FILE__, 7);
putenv('SIMPLETEST_DB=pgsql://user:pass@127.0.0.1/db');
- $connection_info = Database::convertDbUrlToConnectionInfo('mysql://user:pass@localhost/db', $root);
+ $connection_info = Database::convertDbUrlToConnectionInfo('mysql://user:pass@localhost/db');
Database::addConnectionInfo('default', 'default', $connection_info);
$this->assertEquals('mysql', Database::getConnectionInfo()['default']['driver']);
$this->assertEquals('localhost', Database::getConnectionInfo()['default']['host']);
diff --git a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php
index db4ccefa9cb..0de9aa85ce9 100644
--- a/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php
@@ -15,7 +15,7 @@ class TestSuiteBaseTest extends TestCase {
* Tests the assumption that local time is in 'Australia/Sydney'.
*/
public function testLocalTimeZone(): void {
- // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php
+ // The 'Australia/Sydney' time zone is set in core/tests/bootstrap.php.
$this->assertEquals('Australia/Sydney', date_default_timezone_get());
}
diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php
index 4e0555eb2ae..71f0098a902 100644
--- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentMetadataTest.php
@@ -4,9 +4,11 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Theme\Component;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Theme\Component\ComponentMetadata;
use Drupal\Core\Render\Component\Exception\InvalidComponentException;
use Drupal\Tests\UnitTestCaseTest;
+use PHPUnit\Framework\Attributes\DataProvider;
/**
* Unit tests for the component metadata class.
@@ -18,9 +20,8 @@ class ComponentMetadataTest extends UnitTestCaseTest {
/**
* Tests that the correct data is returned for each property.
- *
- * @dataProvider dataProviderMetadata
*/
+ #[DataProvider('dataProviderMetadata')]
public function testMetadata(array $metadata_info, array $expectations): void {
$metadata = new ComponentMetadata($metadata_info, 'foo/', FALSE);
$this->assertSame($expectations['path'], $metadata->path);
@@ -31,9 +32,8 @@ class ComponentMetadataTest extends UnitTestCaseTest {
/**
* Tests the correct checks when enforcing schemas or not.
- *
- * @dataProvider dataProviderMetadata
*/
+ #[DataProvider('dataProviderMetadata')]
public function testMetadataEnforceSchema(array $metadata_info, array $expectations, bool $missing_schema): void {
if ($missing_schema) {
$this->expectException(InvalidComponentException::class);
@@ -71,7 +71,283 @@ class ComponentMetadataTest extends UnitTestCaseTest {
],
TRUE,
],
- 'complete example with schema' => [
+ 'complete example with schema, but no meta:enum' => [
+ [
+ '$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
+ 'id' => 'core:my-button',
+ 'machineName' => 'my-button',
+ 'path' => 'foo/my-other/path',
+ 'name' => 'Button',
+ 'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
+ 'libraryOverrides' => ['dependencies' => ['core/drupal']],
+ 'group' => 'my-group',
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'properties' => [
+ 'text' => [
+ 'type' => 'string',
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => 'string',
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
+ 'path' => 'my-other/path',
+ 'status' => 'stable',
+ 'thumbnail' => '',
+ 'group' => 'my-group',
+ 'additionalProperties' => FALSE,
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'additionalProperties' => FALSE,
+ 'properties' => [
+ 'text' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ 'meta:enum' => [
+ 'power' => new TranslatableMarkup('power', [], ['context' => '']),
+ 'like' => new TranslatableMarkup('like', [], ['context' => '']),
+ 'external' => new TranslatableMarkup('external', [], ['context' => '']),
+ ],
+ ],
+ ],
+ ],
+ ],
+ FALSE,
+ ],
+ 'complete example with schema, but no matching meta:enum' => [
+ [
+ '$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
+ 'id' => 'core:my-button',
+ 'machineName' => 'my-button',
+ 'path' => 'foo/my-other/path',
+ 'name' => 'Button',
+ 'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
+ 'libraryOverrides' => ['dependencies' => ['core/drupal']],
+ 'group' => 'my-group',
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'properties' => [
+ 'text' => [
+ 'type' => 'string',
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => 'string',
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ 'meta:enum' => [
+ 'power' => 'Power',
+ 'fav' => 'Favorite',
+ 'external' => 'External',
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
+ 'path' => 'my-other/path',
+ 'status' => 'stable',
+ 'thumbnail' => '',
+ 'group' => 'my-group',
+ 'additionalProperties' => FALSE,
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'additionalProperties' => FALSE,
+ 'properties' => [
+ 'text' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ 'meta:enum' => [
+ 'power' => new TranslatableMarkup('Power', [], ['context' => '']),
+ 'like' => new TranslatableMarkup('like', [], ['context' => '']),
+ 'external' => new TranslatableMarkup('External', [], ['context' => '']),
+ ],
+ ],
+ ],
+ ],
+ ],
+ FALSE,
+ ],
+ 'complete example with schema, but no meta:enum, prop value not as string' => [
+ [
+ '$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
+ 'id' => 'core:my-button',
+ 'machineName' => 'my-button',
+ 'path' => 'foo/my-other/path',
+ 'name' => 'Button',
+ 'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
+ 'libraryOverrides' => ['dependencies' => ['core/drupal']],
+ 'group' => 'my-group',
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'properties' => [
+ 'col' => [
+ 'type' => 'string',
+ 'title' => 'Column',
+ 'enum' => [
+ 1,
+ 2,
+ 3,
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
+ 'path' => 'my-other/path',
+ 'status' => 'stable',
+ 'thumbnail' => '',
+ 'group' => 'my-group',
+ 'additionalProperties' => FALSE,
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'additionalProperties' => FALSE,
+ 'properties' => [
+ 'col' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Column',
+ 'enum' => [
+ 1,
+ 2,
+ 3,
+ ],
+ 'meta:enum' => [
+ 1 => new TranslatableMarkup('1', [], ['context' => '']),
+ 2 => new TranslatableMarkup('2', [], ['context' => '']),
+ 3 => new TranslatableMarkup('3', [], ['context' => '']),
+ ],
+ ],
+ ],
+ ],
+ ],
+ FALSE,
+ ],
+ 'complete example with schema (including meta:enum)' => [
+ [
+ '$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
+ 'id' => 'core:my-button',
+ 'machineName' => 'my-button',
+ 'path' => 'foo/my-other/path',
+ 'name' => 'Button',
+ 'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
+ 'libraryOverrides' => ['dependencies' => ['core/drupal']],
+ 'group' => 'my-group',
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'properties' => [
+ 'text' => [
+ 'type' => 'string',
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => 'string',
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ 'meta:enum' => [
+ 'power' => 'Power',
+ 'like' => 'Like',
+ 'external' => 'External',
+ ],
+ ],
+ ],
+ ],
+ ],
+ [
+ 'path' => 'my-other/path',
+ 'status' => 'stable',
+ 'thumbnail' => '',
+ 'group' => 'my-group',
+ 'additionalProperties' => FALSE,
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'additionalProperties' => FALSE,
+ 'properties' => [
+ 'text' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'iconType' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Icon Type',
+ 'enum' => [
+ 'power',
+ 'like',
+ 'external',
+ ],
+ 'meta:enum' => [
+ 'power' => new TranslatableMarkup('Power', [], ['context' => '']),
+ 'like' => new TranslatableMarkup('Like', [], ['context' => '']),
+ 'external' => new TranslatableMarkup('External', [], ['context' => '']),
+ ],
+ ],
+ ],
+ ],
+ ],
+ FALSE,
+ ],
+ 'complete example with schema (including meta:enum and x-translation-context)' => [
[
'$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
'id' => 'core:my-button',
@@ -100,6 +376,12 @@ class ComponentMetadataTest extends UnitTestCaseTest {
'like',
'external',
],
+ 'meta:enum' => [
+ 'power' => 'Power',
+ 'like' => 'Like',
+ 'external' => 'External',
+ ],
+ 'x-translation-context' => 'Icon Type',
],
],
],
@@ -130,6 +412,85 @@ class ComponentMetadataTest extends UnitTestCaseTest {
'like',
'external',
],
+ 'meta:enum' => [
+ 'power' => new TranslatableMarkup('Power', [], ['context' => 'Icon Type']),
+ 'like' => new TranslatableMarkup('Like', [], ['context' => 'Icon Type']),
+ 'external' => new TranslatableMarkup('External', [], ['context' => 'Icon Type']),
+ ],
+ 'x-translation-context' => 'Icon Type',
+ ],
+ ],
+ ],
+ ],
+ FALSE,
+ ],
+ 'complete example with schema (including meta:enum and x-translation-context and an empty value)' => [
+ [
+ '$schema' => 'https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json',
+ 'id' => 'core:my-button',
+ 'machineName' => 'my-button',
+ 'path' => 'foo/my-other/path',
+ 'name' => 'Button',
+ 'description' => 'JavaScript enhanced button that tracks the number of times a user clicked it.',
+ 'libraryOverrides' => ['dependencies' => ['core/drupal']],
+ 'group' => 'my-group',
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'properties' => [
+ 'text' => [
+ 'type' => 'string',
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'target' => [
+ 'type' => 'string',
+ 'title' => 'Icon Type',
+ 'enum' => [
+ '',
+ '_blank',
+ ],
+ 'meta:enum' => [
+ '' => 'Opens in same window',
+ '_blank' => 'Opens in new window',
+ ],
+ 'x-translation-context' => 'Link target',
+ ],
+ ],
+ ],
+ ],
+ [
+ 'path' => 'my-other/path',
+ 'status' => 'stable',
+ 'thumbnail' => '',
+ 'group' => 'my-group',
+ 'additionalProperties' => FALSE,
+ 'props' => [
+ 'type' => 'object',
+ 'required' => ['text'],
+ 'additionalProperties' => FALSE,
+ 'properties' => [
+ 'text' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Title',
+ 'description' => 'The title for the button',
+ 'minLength' => 2,
+ 'examples' => ['Press', 'Submit now'],
+ ],
+ 'target' => [
+ 'type' => ['string', 'object'],
+ 'title' => 'Icon Type',
+ 'enum' => [
+ '',
+ '_blank',
+ ],
+ 'meta:enum' => [
+ '' => new TranslatableMarkup('Opens in same window', [], ['context' => 'Link target']),
+ '_blank' => new TranslatableMarkup('Opens in new window', [], ['context' => 'Link target']),
+ ],
+ 'x-translation-context' => 'Link target',
],
],
],
diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
index 46d77602c39..a126e4a81d9 100644
--- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php
@@ -5,16 +5,17 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Theme\Component;
use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Theme\Component\ComponentValidator;
use Drupal\Core\Render\Component\Exception\InvalidComponentException;
use Drupal\Core\Plugin\Component;
+use Drupal\Tests\UnitTestCaseTest;
use JsonSchema\ConstraintError;
use JsonSchema\Constraints\Factory;
use JsonSchema\Constraints\FormatConstraint;
use JsonSchema\Entity\JsonPointer;
use JsonSchema\Validator;
-use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Yaml;
/**
@@ -23,7 +24,7 @@ use Symfony\Component\Yaml\Yaml;
* @coversDefaultClass \Drupal\Core\Theme\Component\ComponentValidator
* @group sdc
*/
-class ComponentValidatorTest extends TestCase {
+class ComponentValidatorTest extends UnitTestCaseTest {
/**
* Tests that valid component definitions don't cause errors.
@@ -191,6 +192,11 @@ class ComponentValidatorTest extends TestCase {
* @throws \Drupal\Core\Render\Component\Exception\InvalidComponentException
*/
public function testValidatePropsValid(array $context, string $component_id, array $definition): void {
+ $translation = $this->getStringTranslationStub();
+ $container = new ContainerBuilder();
+ $container->set('string_translation', $translation);
+ \Drupal::setContainer($container);
+
$component = new Component(
['app_root' => '/fake/path/root'],
'sdc_test:' . $component_id,
@@ -235,6 +241,11 @@ class ComponentValidatorTest extends TestCase {
* Tests we can use a custom validator to validate props.
*/
public function testCustomValidator(): void {
+ $translation = $this->getStringTranslationStub();
+ $container = new ContainerBuilder();
+ $container->set('string_translation', $translation);
+ \Drupal::setContainer($container);
+
$component = new Component(
['app_root' => '/fake/path/root'],
'sdc_test:my-cta',
@@ -266,6 +277,11 @@ class ComponentValidatorTest extends TestCase {
* @throws \Drupal\Core\Render\Component\Exception\InvalidComponentException
*/
public function testValidatePropsInvalid(array $context, string $component_id, array $definition, string $expected_exception_message): void {
+ $translation = $this->getStringTranslationStub();
+ $container = new ContainerBuilder();
+ $container->set('string_translation', $translation);
+ \Drupal::setContainer($container);
+
$component = new Component(
['app_root' => '/fake/path/root'],
'sdc_test:' . $component_id,
@@ -360,13 +376,7 @@ class UrlHelperFormatConstraint extends FormatConstraint {
}
if ($schema->format === 'uri') {
if (\is_string($element) && !UrlHelper::isValid($element)) {
- if (class_exists(ConstraintError::class)) {
- $this->addError(ConstraintError::FORMAT_URL(), $path, ['format' => $schema->format]);
- }
- else {
- // @todo Remove when we no longer support justinrainbow/json-schema v5.
- $this->addError($path, 'Invalid URL format', 'format', ['format' => $schema->format]);
- }
+ $this->addError(ConstraintError::FORMAT_URL, $path, ['format' => $schema->format]);
}
return;
}
diff --git a/core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php b/core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php
index 2c67cf9193f..d1a6e643340 100644
--- a/core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\Tests\Core\Theme\Icon;
use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\Render\ElementInfoManagerInterface;
use Drupal\Core\Render\Element\Icon;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Theme\Icon\IconDefinition;
@@ -41,7 +42,7 @@ class IconTest extends UnitTestCase {
* Test the Icon::getInfo method.
*/
public function testGetInfo(): void {
- $icon = new Icon([], 'test', 'test');
+ $icon = new Icon([], 'test', 'test', elementInfoManager: $this->createStub(ElementInfoManagerInterface::class));
$info = $icon->getInfo();
$this->assertArrayHasKey('#pre_render', $info);
diff --git a/core/tests/Drupal/Tests/DrupalTestBrowser.php b/core/tests/Drupal/Tests/DrupalTestBrowser.php
index 6c9b10b3ff1..663779fde1a 100644
--- a/core/tests/Drupal/Tests/DrupalTestBrowser.php
+++ b/core/tests/Drupal/Tests/DrupalTestBrowser.php
@@ -94,7 +94,7 @@ class DrupalTestBrowser extends AbstractBrowser {
if (str_starts_with($key, 'http-')) {
$headers[substr($key, 5)] = $val;
}
- // CONTENT_* are not prefixed with HTTP_
+ // "CONTENT_*" are not prefixed with "HTTP_".
elseif (isset($content_headers[$key])) {
$headers[$key] = $val;
}
@@ -134,7 +134,7 @@ class DrupalTestBrowser extends AbstractBrowser {
$method = $request->getMethod();
$uri = $request->getUri();
- // Let BrowserKit handle redirects
+ // Let BrowserKit handle redirects.
try {
$response = $this->getClient()->request($method, $uri, $request_options);
}
diff --git a/core/tests/Drupal/Tests/RequirementsPageTrait.php b/core/tests/Drupal/Tests/RequirementsPageTrait.php
index c10e5676079..25f39e49ed8 100644
--- a/core/tests/Drupal/Tests/RequirementsPageTrait.php
+++ b/core/tests/Drupal/Tests/RequirementsPageTrait.php
@@ -14,7 +14,7 @@ trait RequirementsPageTrait {
/**
* Handles the update requirements page.
*/
- protected function updateRequirementsProblem() {
+ protected function updateRequirementsProblem(): void {
// Assert a warning is shown on older test environments.
$links = $this->getSession()->getPage()->findAll('named', ['link', 'try again']);
@@ -37,7 +37,7 @@ trait RequirementsPageTrait {
* next screen of the installer. If an expected warning is not found, or if
* a warning not in the list is present, a fail is raised.
*/
- protected function continueOnExpectedWarnings($expected_warnings = []) {
+ protected function continueOnExpectedWarnings($expected_warnings = []): void {
$this->assertSession()->pageTextNotContains('Errors found');
$this->assertWarningSummaries($expected_warnings);
$this->clickLink('continue anyway');
@@ -54,7 +54,7 @@ trait RequirementsPageTrait {
* A list of warning summaries to expect on the requirements screen (e.g.
* 'PHP', 'PHP OPcode caching', etc.).
*/
- protected function assertWarningSummaries(array $summaries) {
+ protected function assertWarningSummaries(array $summaries): void {
$this->assertRequirementSummaries($summaries, 'warning');
}
@@ -68,7 +68,7 @@ trait RequirementsPageTrait {
* A list of error summaries to expect on the requirements screen (e.g.
* 'PHP', 'PHP OPcode caching', etc.).
*/
- protected function assertErrorSummaries(array $summaries) {
+ protected function assertErrorSummaries(array $summaries): void {
$this->assertRequirementSummaries($summaries, 'error');
}
@@ -84,7 +84,7 @@ trait RequirementsPageTrait {
* @param string $type
* The type of requirement, either 'warning' or 'error'.
*/
- protected function assertRequirementSummaries(array $summaries, string $type) {
+ protected function assertRequirementSummaries(array $summaries, string $type): void {
// The selectors are different for Claro.
$is_claro = stripos($this->getSession()->getPage()->getContent(), 'claro/css/theme/maintenance-page.css') !== FALSE;
diff --git a/core/tests/Drupal/Tests/SchemaCheckTestTrait.php b/core/tests/Drupal/Tests/SchemaCheckTestTrait.php
index 26f97c482b4..177744e9a2d 100644
--- a/core/tests/Drupal/Tests/SchemaCheckTestTrait.php
+++ b/core/tests/Drupal/Tests/SchemaCheckTestTrait.php
@@ -24,7 +24,7 @@ trait SchemaCheckTestTrait {
* @param array $config_data
* The configuration data.
*/
- public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data) {
+ public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $config_name, $config_data): void {
$check = $this->checkConfigSchema($typed_config, $config_name, $config_data);
$message = '';
if ($check === FALSE) {
@@ -46,7 +46,7 @@ trait SchemaCheckTestTrait {
* @param string $config_name
* The configuration name.
*/
- public function assertConfigSchemaByName($config_name) {
+ public function assertConfigSchemaByName($config_name): void {
$config = $this->config($config_name);
$this->assertConfigSchema(\Drupal::service('config.typed'), $config->getName(), $config->get());
}
diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php
index 2257148d069..b279bd1ed25 100644
--- a/core/tests/Drupal/Tests/UnitTestCase.php
+++ b/core/tests/Drupal/Tests/UnitTestCase.php
@@ -13,6 +13,7 @@ use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait;
use Drupal\TestTools\Extension\Dump\DebugDump;
use PHPUnit\Framework\Attributes\BeforeClass;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\VarDumper\VarDumper;
@@ -210,4 +211,32 @@ abstract class UnitTestCase extends TestCase {
return $class_resolver;
}
+ /**
+ * Set up a traversable class mock to return specific items when iterated.
+ *
+ * Test doubles for types extending \Traversable are required to implement
+ * \Iterator which requires setting up five methods. Instead, this helper
+ * can be used.
+ *
+ * @param \PHPUnit\Framework\MockObject\MockObject&\Iterator $mock
+ * A mock object mocking a traversable class.
+ * @param array $items
+ * The items to return when this mock is iterated.
+ *
+ * @return \PHPUnit\Framework\MockObject\MockObject&\Iterator
+ * The same mock object ready to be iterated.
+ *
+ * @template T of \PHPUnit\Framework\MockObject\MockObject&\Iterator
+ * @phpstan-param T $mock
+ * @phpstan-return T
+ * @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103
+ */
+ protected function setupMockIterator(MockObject&\Iterator $mock, array $items): MockObject&\Iterator {
+ $iterator = new \ArrayIterator($items);
+ foreach (get_class_methods(\Iterator::class) as $method) {
+ $mock->method($method)->willReturnCallback([$iterator, $method]);
+ }
+ return $mock;
+ }
+
}
diff --git a/core/tests/Drupal/Tests/UpdatePathTestTrait.php b/core/tests/Drupal/Tests/UpdatePathTestTrait.php
index c79916fca28..deaa20997fb 100644
--- a/core/tests/Drupal/Tests/UpdatePathTestTrait.php
+++ b/core/tests/Drupal/Tests/UpdatePathTestTrait.php
@@ -36,7 +36,7 @@ trait UpdatePathTestTrait {
* @param string|null $update_url
* The update URL.
*/
- protected function runUpdates($update_url = NULL) {
+ protected function runUpdates($update_url = NULL): void {
if (!$update_url) {
$update_url = Url::fromRoute('system.db_update');
}
@@ -167,7 +167,7 @@ trait UpdatePathTestTrait {
/**
* Tests the selection page.
*/
- protected function doSelectionTest() {
+ protected function doSelectionTest(): void {
// No-op. Tests wishing to do test the selection page or the general
// update.php environment before running update.php can override this method
// and implement their required tests.
@@ -176,7 +176,7 @@ trait UpdatePathTestTrait {
/**
* Installs the update_script_test module and makes an update available.
*/
- protected function ensureUpdatesToRun() {
+ protected function ensureUpdatesToRun(): void {
\Drupal::service('module_installer')->install(['update_script_test']);
// Reset the schema so there is an update to run.
\Drupal::service('update.update_hook_registry')->setInstalledVersion('update_script_test', 8000);
diff --git a/core/tests/PHPStan/composer.json b/core/tests/PHPStan/composer.json
index 62e1876dea7..5d5e5165168 100644
--- a/core/tests/PHPStan/composer.json
+++ b/core/tests/PHPStan/composer.json
@@ -3,7 +3,7 @@
"description": "Tests Drupal core's PHPStan rules",
"require-dev": {
"phpunit/phpunit": "^11",
- "phpstan/phpstan": "2.1.14"
+ "phpstan/phpstan": "2.1.17"
},
"license": "GPL-2.0-or-later",
"autoload": {
diff --git a/core/tests/fixtures/default_content/node/48475954-e878-439c-9d3d-226724a44269.yml b/core/tests/fixtures/default_content/node/48475954-e878-439c-9d3d-226724a44269.yml
new file mode 100644
index 00000000000..bae16bcd3f9
--- /dev/null
+++ b/core/tests/fixtures/default_content/node/48475954-e878-439c-9d3d-226724a44269.yml
@@ -0,0 +1,47 @@
+_meta:
+ version: '1.0'
+ entity_type: node
+ uuid: 48475954-e878-439c-9d3d-226724a44269
+ bundle: page
+ default_langcode: en
+ depends:
+ 384c4c10-cc41-4d7e-a1cc-85d1cdc9e87d: workspace
+default:
+ revision_uid:
+ -
+ target_id: 1
+ status:
+ -
+ value: false
+ uid:
+ -
+ target_id: 1
+ title:
+ -
+ value: 'A happy little workspace'
+ created:
+ -
+ value: 1751155670
+ promote:
+ -
+ value: false
+ sticky:
+ -
+ value: false
+ revision_translation_affected:
+ -
+ value: true
+ path:
+ -
+ alias: ''
+ langcode: en
+ # TRICKY! Default Content does not export the `workspace` field because it skips internal
+ # properties, but core's exporter should be sure to include it.
+ workspace:
+ -
+ target_id: test_workspace
+ body:
+ -
+ value: 'This page lives in a workspace! How neat!'
+ format: plain_text
+ summary: ''
diff --git a/core/tests/fixtures/default_content/workspace/inner_test.yml b/core/tests/fixtures/default_content/workspace/inner_test.yml
new file mode 100644
index 00000000000..45a1bcc22dc
--- /dev/null
+++ b/core/tests/fixtures/default_content/workspace/inner_test.yml
@@ -0,0 +1,24 @@
+_meta:
+ version: '1.0'
+ entity_type: workspace
+ uuid: 93f5b0b4-ada9-4bcd-a11d-f7329e9afe21
+ depends:
+ 384c4c10-cc41-4d7e-a1cc-85d1cdc9e87d: workspace
+default:
+ # TRICKY! Default Content does not export the `id` field, but core's exporter should.
+ # Without it, the import will fail.
+ id:
+ -
+ value: inner_test
+ uid:
+ -
+ target_id: 1
+ label:
+ -
+ value: 'Inner Test'
+ parent:
+ -
+ entity: 384c4c10-cc41-4d7e-a1cc-85d1cdc9e87d
+ created:
+ -
+ value: 1751154834
diff --git a/core/tests/fixtures/default_content/workspace/test_workspace.yml b/core/tests/fixtures/default_content/workspace/test_workspace.yml
new file mode 100644
index 00000000000..c2237940679
--- /dev/null
+++ b/core/tests/fixtures/default_content/workspace/test_workspace.yml
@@ -0,0 +1,19 @@
+_meta:
+ version: '1.0'
+ entity_type: workspace
+ uuid: 384c4c10-cc41-4d7e-a1cc-85d1cdc9e87d
+default:
+ # TRICKY! Default Content does not export the `id` field, but core's exporter should.
+ # Without it, the import will fail.
+ id:
+ -
+ value: test_workspace
+ uid:
+ -
+ target_id: 1
+ label:
+ -
+ value: 'Test Workspace'
+ created:
+ -
+ value: 1751154825