From 493149eeafba87db85f024a47798d3bf858a715d Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Sun, 20 Feb 2022 14:57:21 +0000 Subject: [PATCH] Issue #3263654 by Spokje, bbrala, daffie, Kristen Pol, longwave: Move all HAL tests to the module in preparation of removal in D10 --- core/core.api.php | 2 +- .../Views/CommentFieldFilterTest.php | 2 +- .../src/Functional/Views/CommentTestBase.php | 4 +- .../optional/rest.resource.entity.node.yml | 0 .../modules/hal/help_topics/hal.hal.html.twig | 10 + .../hal_test_views/hal_test_views.info.yml | 8 + .../views.view.test_comment_hal.yml} | 3 +- ...ws.view.test_serializer_display_entity.yml | 54 ++++ .../BaseFieldOverrideHalJsonAnonTest.php | 2 +- .../BaseFieldOverrideHalJsonBasicAuthTest.php | 2 +- .../BaseFieldOverrideHalJsonCookieTest.php | 2 +- .../Core}/DateFormatHalJsonAnonTest.php | 2 +- .../Core}/DateFormatHalJsonBasicAuthTest.php | 2 +- .../Core}/DateFormatHalJsonCookieTest.php | 2 +- .../EntityFormDisplayHalJsonAnonTest.php | 2 +- .../EntityFormDisplayHalJsonBasicAuthTest.php | 2 +- .../EntityFormDisplayHalJsonCookieTest.php | 2 +- .../Core}/EntityFormModeHalJsonAnonTest.php | 2 +- .../EntityFormModeHalJsonBasicAuthTest.php | 2 +- .../Core}/EntityFormModeHalJsonCookieTest.php | 2 +- .../EntityViewDisplayHalJsonAnonTest.php | 2 +- .../EntityViewDisplayHalJsonBasicAuthTest.php | 2 +- .../EntityViewDisplayHalJsonCookieTest.php | 2 +- .../Core}/EntityViewModeHalJsonAnonTest.php | 2 +- .../EntityViewModeHalJsonBasicAuthTest.php | 2 +- .../Core}/EntityViewModeHalJsonCookieTest.php | 2 +- .../aggregator}/FeedHalJsonAnonTest.php | 2 +- .../aggregator}/FeedHalJsonBasicAuthTest.php | 2 +- .../aggregator}/FeedHalJsonCookieTest.php | 2 +- .../aggregator}/FeedHalJsonTestBase.php | 2 +- .../aggregator}/ItemHalJsonAnonTest.php | 2 +- .../aggregator}/ItemHalJsonBasicAuthTest.php | 2 +- .../aggregator}/ItemHalJsonCookieTest.php | 2 +- .../aggregator}/ItemHalJsonTestBase.php | 2 +- .../block}/BlockHalJsonAnonTest.php | 2 +- .../block}/BlockHalJsonBasicAuthTest.php | 2 +- .../block}/BlockHalJsonCookieTest.php | 2 +- .../BlockContentHalJsonAnonTest.php | 2 +- .../BlockContentHalJsonBasicAuthTest.php | 2 +- .../BlockContentHalJsonCookieTest.php | 2 +- .../BlockContentTypeHalJsonAnonTest.php | 2 +- .../BlockContentTypeHalJsonBasicAuthTest.php | 2 +- .../BlockContentTypeHalJsonCookieTest.php | 2 +- .../comment}/CommentHalJsonAnonTest.php | 2 +- .../comment}/CommentHalJsonBasicAuthTest.php | 2 +- .../comment}/CommentHalJsonCookieTest.php | 2 +- .../comment}/CommentHalJsonTestBase.php | 2 +- .../comment}/CommentTypeHalJsonAnonTest.php | 2 +- .../CommentTypeHalJsonBasicAuthTest.php | 2 +- .../comment}/CommentTypeHalJsonCookieTest.php | 2 +- .../comment/Views/CommentHalExportTest.php} | 15 +- .../config}/ConfigTestHalJsonAnonTest.php | 2 +- .../ConfigTestHalJsonBasicAuthTest.php | 2 +- .../config}/ConfigTestHalJsonCookieTest.php | 2 +- .../contact}/ContactFormHalJsonAnonTest.php | 2 +- .../ContactFormHalJsonBasicAuthTest.php | 2 +- .../contact}/ContactFormHalJsonCookieTest.php | 2 +- .../contact}/MessageHalJsonAnonTest.php | 2 +- .../contact}/MessageHalJsonBasicAuthTest.php | 2 +- .../contact}/MessageHalJsonCookieTest.php | 2 +- .../Functional/dblog}/DbLogResourceTest.php | 4 +- .../editor}/EditorHalJsonAnonTest.php | 2 +- .../editor}/EditorHalJsonBasicAuthTest.php | 2 +- .../editor}/EditorHalJsonCookieTest.php | 2 +- .../EntityTestBundleHalJsonAnonTest.php | 2 +- .../EntityTestBundleHalJsonBasicAuthTest.php | 2 +- .../EntityTestBundleHalJsonCookieTest.php | 2 +- .../EntityTestHalJsonAnonTest.php | 2 +- .../EntityTestHalJsonBasicAuthTest.php | 2 +- .../EntityTestHalJsonCookieTest.php | 2 +- ...tHalJsonInternalPropertyNormalizerTest.php | 2 +- .../EntityTestLabelHalJsonAnonTest.php | 2 +- .../EntityTestLabelHalJsonBasicAuthTest.php | 2 +- .../EntityTestLabelHalJsonCookieTest.php | 2 +- .../EntityTestMapFieldHalJsonAnonTest.php | 2 +- .../field}/FieldConfigHalJsonAnonTest.php | 2 +- .../FieldConfigHalJsonBasicAuthTest.php | 2 +- .../field}/FieldConfigHalJsonCookieTest.php | 2 +- .../FieldStorageConfigHalJsonAnonTest.php | 2 +- ...FieldStorageConfigHalJsonBasicAuthTest.php | 2 +- .../FieldStorageConfigHalJsonCookieTest.php | 2 +- .../Functional/file}/FileHalJsonAnonTest.php | 2 +- .../file}/FileHalJsonBasicAuthTest.php | 2 +- .../file}/FileHalJsonCookieTest.php | 2 +- .../file}/FileUploadHalJsonBasicAuthTest.php | 2 +- .../file}/FileUploadHalJsonCookieTest.php | 2 +- .../file}/FileUploadHalJsonTestBase.php | 2 +- .../filter}/FilterFormatHalJsonAnonTest.php | 2 +- .../FilterFormatHalJsonBasicAuthTest.php | 2 +- .../filter}/FilterFormatHalJsonCookieTest.php | 2 +- .../image}/ImageStyleHalJsonAnonTest.php | 2 +- .../image}/ImageStyleHalJsonBasicAuthTest.php | 2 +- .../image}/ImageStyleHalJsonCookieTest.php | 2 +- .../ConfigurableLanguageHalJsonAnonTest.php | 2 +- ...nfigurableLanguageHalJsonBasicAuthTest.php | 2 +- .../ConfigurableLanguageHalJsonCookieTest.php | 2 +- ...ContentLanguageSettingsHalJsonAnonTest.php | 2 +- ...ntLanguageSettingsHalJsonBasicAuthTest.php | 2 +- ...ntentLanguageSettingsHalJsonCookieTest.php | 2 +- ...uilderEntityViewDisplayHalJsonAnonTest.php | 5 +- ...rEntityViewDisplayHalJsonBasicAuthTest.php | 7 +- ...lderEntityViewDisplayHalJsonCookieTest.php | 5 +- .../media}/MediaHalJsonAnonTest.php | 2 +- .../media}/MediaHalJsonBasicAuthTest.php | 2 +- .../media}/MediaHalJsonCookieTest.php | 2 +- .../media}/MediaTypeHalJsonAnonTest.php | 2 +- .../media}/MediaTypeHalJsonBasicAuthTest.php | 2 +- .../media}/MediaTypeHalJsonCookieTest.php | 2 +- .../MenuLinkContentHalJsonAnonTest.php | 2 +- .../MenuLinkContentHalJsonBasicAuthTest.php | 2 +- .../MenuLinkContentHalJsonCookieTest.php | 2 +- .../Functional/node}/NodeHalJsonAnonTest.php | 2 +- .../node}/NodeHalJsonBasicAuthTest.php | 2 +- .../node}/NodeHalJsonCookieTest.php | 2 +- .../node}/NodeTypeHalJsonAnonTest.php | 2 +- .../node}/NodeTypeHalJsonBasicAuthTest.php | 2 +- .../node}/NodeTypeHalJsonCookieTest.php | 2 +- .../Functional/page_cache/PageCacheTest.php | 133 ++++++++ .../path_alias}/PathAliasHalJsonAnonTest.php | 3 +- .../PathAliasHalJsonBasicAuthTest.php | 3 +- .../PathAliasHalJsonCookieTest.php | 3 +- .../path_alias}/PathAliasHalJsonTestBase.php | 2 +- .../rdf}/RdfMappingHalJsonAnonTest.php | 2 +- .../rdf}/RdfMappingHalJsonBasicAuthTest.php | 2 +- .../rdf}/RdfMappingHalJsonCookieTest.php | 2 +- .../ResponsiveImageStyleHalJsonAnonTest.php | 2 +- ...sponsiveImageStyleHalJsonBasicAuthTest.php | 2 +- .../ResponsiveImageStyleHalJsonCookieTest.php | 2 +- .../RestResourceConfigHalJsonAnonTest.php | 2 +- ...RestResourceConfigHalJsonBasicAuthTest.php | 2 +- .../RestResourceConfigHalJsonCookieTest.php | 2 +- .../rest/Views/StyleSerializerTest.php | 109 +++++++ .../search}/SearchPageHalJsonAnonTest.php | 2 +- .../SearchPageHalJsonBasicAuthTest.php | 2 +- .../search}/SearchPageHalJsonCookieTest.php | 2 +- .../shortcut}/ShortcutHalJsonAnonTest.php | 2 +- .../ShortcutHalJsonBasicAuthTest.php | 2 +- .../shortcut}/ShortcutHalJsonCookieTest.php | 2 +- .../shortcut}/ShortcutSetHalJsonAnonTest.php | 2 +- .../ShortcutSetHalJsonBasicAuthTest.php | 2 +- .../ShortcutSetHalJsonCookieTest.php | 2 +- .../system}/ActionHalJsonAnonTest.php | 2 +- .../system}/ActionHalJsonBasicAuthTest.php | 2 +- .../system}/ActionHalJsonCookieTest.php | 2 +- .../system}/MenuHalJsonAnonTest.php | 2 +- .../system}/MenuHalJsonBasicAuthTest.php | 2 +- .../system}/MenuHalJsonCookieTest.php | 2 +- .../taxonomy}/TermHalJsonAnonTest.php | 2 +- .../taxonomy}/TermHalJsonBasicAuthTest.php | 2 +- .../taxonomy}/TermHalJsonCookieTest.php | 2 +- .../taxonomy}/VocabularyHalJsonAnonTest.php | 2 +- .../VocabularyHalJsonBasicAuthTest.php | 2 +- .../taxonomy}/VocabularyHalJsonCookieTest.php | 2 +- .../Functional/tour}/TourHalJsonAnonTest.php | 2 +- .../tour}/TourHalJsonBasicAuthTest.php | 2 +- .../tour}/TourHalJsonCookieTest.php | 2 +- .../Functional/user}/RestRegisterUserTest.php | 4 +- .../Functional/user}/RoleHalJsonAnonTest.php | 2 +- .../user}/RoleHalJsonBasicAuthTest.php | 2 +- .../user}/RoleHalJsonCookieTest.php | 2 +- .../Functional/user}/UserHalJsonAnonTest.php | 2 +- .../user}/UserHalJsonBasicAuthTest.php | 2 +- .../user}/UserHalJsonCookieTest.php | 2 +- .../Functional/user/UserHalLoginHttpTest.php | 54 ++++ .../Functional/views}/ViewHalJsonAnonTest.php | 2 +- .../views}/ViewHalJsonBasicAuthTest.php | 2 +- .../views}/ViewHalJsonCookieTest.php | 2 +- .../workflows}/WorkflowHalJsonAnonTest.php | 2 +- .../WorkflowHalJsonBasicAuthTest.php | 2 +- .../workflows}/WorkflowHalJsonCookieTest.php | 2 +- .../tests/src/Kernel/EntityResolverTest.php | 5 +- .../EntityResourceHalTestCoverageTest.php | 118 +++++++ .../rest/Entity/ConfigDependenciesTest.php | 290 ++++++++++++++++++ .../rest/Entity/RestResourceConfigTest.php | 51 +++ .../rest/Views/StyleSerializerKernelTest.php | 50 +++ .../FieldItemSerializationTest.php | 194 ++++++++++++ .../help_topics/core.web_services.html.twig | 2 +- .../tests/src/Functional/PageCacheTest.php | 40 --- .../EntityResource/EntityResourceTestBase.php | 5 - .../tests/src/Functional/ResourceTest.php | 8 +- .../Functional/Views/StyleSerializerTest.php | 8 +- .../Kernel/Entity/ConfigDependenciesTest.php | 112 +------ .../src/Kernel/Entity/RestPermissionsTest.php | 1 - .../Kernel/Entity/RestResourceConfigTest.php | 5 +- .../EntityResourceRestTestCoverageTest.php | 11 +- .../Views/StyleSerializerKernelTest.php | 10 - .../src/Kernel/FieldItemSerializationTest.php | 12 - ...erSerializationClassesCompilerPassTest.php | 11 +- .../src/AcceptHeaderMiddleware.php | 1 - .../System/ResponseGeneratorTest.php | 42 ++- .../src/Functional/UserLoginHttpTest.php | 76 ++--- .../Routing/ContentTypeHeaderMatcherTest.php | 4 +- .../Tests/Core/Test/TestDiscoveryTest.php | 1 - 193 files changed, 1348 insertions(+), 437 deletions(-) rename core/modules/{rest => hal}/config/optional/rest.resource.entity.node.yml (100%) create mode 100644 core/modules/hal/help_topics/hal.hal.html.twig create mode 100644 core/modules/hal/tests/modules/hal_test_views/hal_test_views.info.yml rename core/modules/{comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rest.yml => hal/tests/modules/hal_test_views/test_views/views.view.test_comment_hal.yml} (99%) create mode 100644 core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_serializer_display_entity.yml rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/BaseFieldOverrideHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/BaseFieldOverrideHalJsonBasicAuthTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/BaseFieldOverrideHalJsonCookieTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/DateFormatHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/DateFormatHalJsonBasicAuthTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/DateFormatHalJsonCookieTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormDisplayHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormDisplayHalJsonBasicAuthTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormDisplayHalJsonCookieTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormModeHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormModeHalJsonBasicAuthTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityFormModeHalJsonCookieTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewDisplayHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewDisplayHalJsonBasicAuthTest.php (90%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewDisplayHalJsonCookieTest.php (88%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewModeHalJsonAnonTest.php (92%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewModeHalJsonBasicAuthTest.php (93%) rename core/{tests/Drupal/FunctionalTests/Hal => modules/hal/tests/src/Functional/Core}/EntityViewModeHalJsonCookieTest.php (93%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/FeedHalJsonAnonTest.php (86%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/FeedHalJsonBasicAuthTest.php (89%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/FeedHalJsonCookieTest.php (86%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/FeedHalJsonTestBase.php (96%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/ItemHalJsonAnonTest.php (90%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/ItemHalJsonBasicAuthTest.php (92%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/ItemHalJsonCookieTest.php (91%) rename core/modules/{aggregator/tests/src/Functional/Hal => hal/tests/src/Functional/aggregator}/ItemHalJsonTestBase.php (98%) rename core/modules/{block/tests/src/Functional/Hal => hal/tests/src/Functional/block}/BlockHalJsonAnonTest.php (92%) rename core/modules/{block/tests/src/Functional/Hal => hal/tests/src/Functional/block}/BlockHalJsonBasicAuthTest.php (93%) rename core/modules/{block/tests/src/Functional/Hal => hal/tests/src/Functional/block}/BlockHalJsonCookieTest.php (93%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentHalJsonAnonTest.php (97%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentHalJsonBasicAuthTest.php (88%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentHalJsonCookieTest.php (86%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentTypeHalJsonAnonTest.php (91%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentTypeHalJsonBasicAuthTest.php (92%) rename core/modules/{block_content/tests/src/Functional/Hal => hal/tests/src/Functional/block_content}/BlockContentTypeHalJsonCookieTest.php (92%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentHalJsonAnonTest.php (94%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentHalJsonBasicAuthTest.php (89%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentHalJsonCookieTest.php (87%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentHalJsonTestBase.php (98%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentTypeHalJsonAnonTest.php (92%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentTypeHalJsonBasicAuthTest.php (93%) rename core/modules/{comment/tests/src/Functional/Hal => hal/tests/src/Functional/comment}/CommentTypeHalJsonCookieTest.php (93%) rename core/modules/{comment/tests/src/Functional/Views/CommentRestExportTest.php => hal/tests/src/Functional/comment/Views/CommentHalExportTest.php} (81%) rename core/modules/{config/tests/config_test/tests/src/Functional/Hal => hal/tests/src/Functional/config}/ConfigTestHalJsonAnonTest.php (91%) rename core/modules/{config/tests/config_test/tests/src/Functional/Hal => hal/tests/src/Functional/config}/ConfigTestHalJsonBasicAuthTest.php (92%) rename core/modules/{config/tests/config_test/tests/src/Functional/Hal => hal/tests/src/Functional/config}/ConfigTestHalJsonCookieTest.php (92%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/ContactFormHalJsonAnonTest.php (92%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/ContactFormHalJsonBasicAuthTest.php (93%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/ContactFormHalJsonCookieTest.php (93%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/MessageHalJsonAnonTest.php (95%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/MessageHalJsonBasicAuthTest.php (89%) rename core/modules/{contact/tests/src/Functional/Hal => hal/tests/src/Functional/contact}/MessageHalJsonCookieTest.php (87%) rename core/modules/{dblog/tests/src/Functional => hal/tests/src/Functional/dblog}/DbLogResourceTest.php (98%) rename core/modules/{editor/tests/src/Functional/Hal => hal/tests/src/Functional/editor}/EditorHalJsonAnonTest.php (92%) rename core/modules/{editor/tests/src/Functional/Hal => hal/tests/src/Functional/editor}/EditorHalJsonBasicAuthTest.php (93%) rename core/modules/{editor/tests/src/Functional/Hal => hal/tests/src/Functional/editor}/EditorHalJsonCookieTest.php (93%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestBundleHalJsonAnonTest.php (93%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestBundleHalJsonBasicAuthTest.php (93%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestBundleHalJsonCookieTest.php (92%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestHalJsonAnonTest.php (97%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestHalJsonBasicAuthTest.php (89%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestHalJsonCookieTest.php (86%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestHalJsonInternalPropertyNormalizerTest.php (98%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestLabelHalJsonAnonTest.php (98%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestLabelHalJsonBasicAuthTest.php (89%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestLabelHalJsonCookieTest.php (87%) rename core/modules/{system/tests/modules/entity_test/tests/src/Functional/Hal => hal/tests/src/Functional/entity_test}/EntityTestMapFieldHalJsonAnonTest.php (98%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldConfigHalJsonAnonTest.php (92%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldConfigHalJsonBasicAuthTest.php (93%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldConfigHalJsonCookieTest.php (93%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldStorageConfigHalJsonAnonTest.php (92%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldStorageConfigHalJsonBasicAuthTest.php (93%) rename core/modules/{field/tests/src/Functional/Hal => hal/tests/src/Functional/field}/FieldStorageConfigHalJsonCookieTest.php (93%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileHalJsonAnonTest.php (98%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileHalJsonBasicAuthTest.php (90%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileHalJsonCookieTest.php (87%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileUploadHalJsonBasicAuthTest.php (90%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileUploadHalJsonCookieTest.php (88%) rename core/modules/{file/tests/src/Functional/Hal => hal/tests/src/Functional/file}/FileUploadHalJsonTestBase.php (98%) rename core/modules/{filter/tests/src/Functional/Hal => hal/tests/src/Functional/filter}/FilterFormatHalJsonAnonTest.php (92%) rename core/modules/{filter/tests/src/Functional/Hal => hal/tests/src/Functional/filter}/FilterFormatHalJsonBasicAuthTest.php (93%) rename core/modules/{filter/tests/src/Functional/Hal => hal/tests/src/Functional/filter}/FilterFormatHalJsonCookieTest.php (93%) rename core/modules/{image/tests/src/Functional/Hal => hal/tests/src/Functional/image}/ImageStyleHalJsonAnonTest.php (92%) rename core/modules/{image/tests/src/Functional/Hal => hal/tests/src/Functional/image}/ImageStyleHalJsonBasicAuthTest.php (93%) rename core/modules/{image/tests/src/Functional/Hal => hal/tests/src/Functional/image}/ImageStyleHalJsonCookieTest.php (93%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ConfigurableLanguageHalJsonAnonTest.php (92%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ConfigurableLanguageHalJsonBasicAuthTest.php (93%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ConfigurableLanguageHalJsonCookieTest.php (93%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ContentLanguageSettingsHalJsonAnonTest.php (92%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ContentLanguageSettingsHalJsonBasicAuthTest.php (93%) rename core/modules/{language/tests/src/Functional/Hal => hal/tests/src/Functional/language}/ContentLanguageSettingsHalJsonCookieTest.php (93%) rename core/modules/{layout_builder/tests/src/Functional/Hal => hal/tests/src/Functional/layout_builder}/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php (86%) rename core/modules/{layout_builder/tests/src/Functional/Hal => hal/tests/src/Functional/layout_builder}/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php (69%) rename core/modules/{layout_builder/tests/src/Functional/Hal => hal/tests/src/Functional/layout_builder}/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php (79%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaHalJsonAnonTest.php (99%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaHalJsonBasicAuthTest.php (90%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaHalJsonCookieTest.php (87%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaTypeHalJsonAnonTest.php (92%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaTypeHalJsonBasicAuthTest.php (93%) rename core/modules/{media/tests/src/Functional/Hal => hal/tests/src/Functional/media}/MediaTypeHalJsonCookieTest.php (93%) rename core/modules/{menu_link_content/tests/src/Functional/Hal => hal/tests/src/Functional/menu_link_content}/MenuLinkContentHalJsonAnonTest.php (96%) rename core/modules/{menu_link_content/tests/src/Functional/Hal => hal/tests/src/Functional/menu_link_content}/MenuLinkContentHalJsonBasicAuthTest.php (88%) rename core/modules/{menu_link_content/tests/src/Functional/Hal => hal/tests/src/Functional/menu_link_content}/MenuLinkContentHalJsonCookieTest.php (85%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeHalJsonAnonTest.php (98%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeHalJsonBasicAuthTest.php (90%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeHalJsonCookieTest.php (87%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeTypeHalJsonAnonTest.php (92%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeTypeHalJsonBasicAuthTest.php (93%) rename core/modules/{node/tests/src/Functional/Hal => hal/tests/src/Functional/node}/NodeTypeHalJsonCookieTest.php (93%) create mode 100644 core/modules/hal/tests/src/Functional/page_cache/PageCacheTest.php rename core/modules/{path_alias/tests/src/Functional/Hal => hal/tests/src/Functional/path_alias}/PathAliasHalJsonAnonTest.php (87%) rename core/modules/{path_alias/tests/src/Functional/Hal => hal/tests/src/Functional/path_alias}/PathAliasHalJsonBasicAuthTest.php (89%) rename core/modules/{path_alias/tests/src/Functional/Hal => hal/tests/src/Functional/path_alias}/PathAliasHalJsonCookieTest.php (88%) rename core/modules/{path_alias/tests/src/Functional/Hal => hal/tests/src/Functional/path_alias}/PathAliasHalJsonTestBase.php (96%) rename core/modules/{rdf/tests/src/Functional/Hal => hal/tests/src/Functional/rdf}/RdfMappingHalJsonAnonTest.php (92%) rename core/modules/{rdf/tests/src/Functional/Hal => hal/tests/src/Functional/rdf}/RdfMappingHalJsonBasicAuthTest.php (93%) rename core/modules/{rdf/tests/src/Functional/Hal => hal/tests/src/Functional/rdf}/RdfMappingHalJsonCookieTest.php (93%) rename core/modules/{responsive_image/tests/src/Functional/Hal => hal/tests/src/Functional/responsive_image}/ResponsiveImageStyleHalJsonAnonTest.php (91%) rename core/modules/{responsive_image/tests/src/Functional/Hal => hal/tests/src/Functional/responsive_image}/ResponsiveImageStyleHalJsonBasicAuthTest.php (92%) rename core/modules/{responsive_image/tests/src/Functional/Hal => hal/tests/src/Functional/responsive_image}/ResponsiveImageStyleHalJsonCookieTest.php (92%) rename core/modules/{rest/tests/src/Functional/Hal => hal/tests/src/Functional/rest}/RestResourceConfigHalJsonAnonTest.php (92%) rename core/modules/{rest/tests/src/Functional/Hal => hal/tests/src/Functional/rest}/RestResourceConfigHalJsonBasicAuthTest.php (93%) rename core/modules/{rest/tests/src/Functional/Hal => hal/tests/src/Functional/rest}/RestResourceConfigHalJsonCookieTest.php (93%) create mode 100644 core/modules/hal/tests/src/Functional/rest/Views/StyleSerializerTest.php rename core/modules/{search/tests/src/Functional/Hal => hal/tests/src/Functional/search}/SearchPageHalJsonAnonTest.php (92%) rename core/modules/{search/tests/src/Functional/Hal => hal/tests/src/Functional/search}/SearchPageHalJsonBasicAuthTest.php (93%) rename core/modules/{search/tests/src/Functional/Hal => hal/tests/src/Functional/search}/SearchPageHalJsonCookieTest.php (93%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutHalJsonAnonTest.php (97%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutHalJsonBasicAuthTest.php (89%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutHalJsonCookieTest.php (87%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutSetHalJsonAnonTest.php (92%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutSetHalJsonBasicAuthTest.php (89%) rename core/modules/{shortcut/tests/src/Functional/Hal => hal/tests/src/Functional/shortcut}/ShortcutSetHalJsonCookieTest.php (87%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/ActionHalJsonAnonTest.php (92%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/ActionHalJsonBasicAuthTest.php (93%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/ActionHalJsonCookieTest.php (93%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/MenuHalJsonAnonTest.php (92%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/MenuHalJsonBasicAuthTest.php (93%) rename core/modules/{system/tests/src/Functional/Hal => hal/tests/src/Functional/system}/MenuHalJsonCookieTest.php (93%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/TermHalJsonAnonTest.php (99%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/TermHalJsonBasicAuthTest.php (89%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/TermHalJsonCookieTest.php (86%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/VocabularyHalJsonAnonTest.php (93%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/VocabularyHalJsonBasicAuthTest.php (93%) rename core/modules/{taxonomy/tests/src/Functional/Hal => hal/tests/src/Functional/taxonomy}/VocabularyHalJsonCookieTest.php (92%) rename core/modules/{tour/tests/src/Functional/Hal => hal/tests/src/Functional/tour}/TourHalJsonAnonTest.php (92%) rename core/modules/{tour/tests/src/Functional/Hal => hal/tests/src/Functional/tour}/TourHalJsonBasicAuthTest.php (93%) rename core/modules/{tour/tests/src/Functional/Hal => hal/tests/src/Functional/tour}/TourHalJsonCookieTest.php (93%) rename core/modules/{user/tests/src/Functional => hal/tests/src/Functional/user}/RestRegisterUserTest.php (99%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/RoleHalJsonAnonTest.php (92%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/RoleHalJsonBasicAuthTest.php (93%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/RoleHalJsonCookieTest.php (93%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/UserHalJsonAnonTest.php (96%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/UserHalJsonBasicAuthTest.php (90%) rename core/modules/{user/tests/src/Functional/Hal => hal/tests/src/Functional/user}/UserHalJsonCookieTest.php (87%) create mode 100644 core/modules/hal/tests/src/Functional/user/UserHalLoginHttpTest.php rename core/modules/{views/tests/src/Functional/Hal => hal/tests/src/Functional/views}/ViewHalJsonAnonTest.php (92%) rename core/modules/{views/tests/src/Functional/Hal => hal/tests/src/Functional/views}/ViewHalJsonBasicAuthTest.php (93%) rename core/modules/{views/tests/src/Functional/Hal => hal/tests/src/Functional/views}/ViewHalJsonCookieTest.php (93%) rename core/modules/{workflows/tests/src/Functional/Hal => hal/tests/src/Functional/workflows}/WorkflowHalJsonAnonTest.php (91%) rename core/modules/{workflows/tests/src/Functional/Hal => hal/tests/src/Functional/workflows}/WorkflowHalJsonBasicAuthTest.php (89%) rename core/modules/{workflows/tests/src/Functional/Hal => hal/tests/src/Functional/workflows}/WorkflowHalJsonCookieTest.php (87%) rename core/modules/{serialization => hal}/tests/src/Kernel/EntityResolverTest.php (95%) create mode 100644 core/modules/hal/tests/src/Kernel/EntityResource/EntityResourceHalTestCoverageTest.php create mode 100644 core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php create mode 100644 core/modules/hal/tests/src/Kernel/rest/Entity/RestResourceConfigTest.php create mode 100644 core/modules/hal/tests/src/Kernel/rest/Views/StyleSerializerKernelTest.php create mode 100644 core/modules/hal/tests/src/Kernel/serialization/FieldItemSerializationTest.php diff --git a/core/core.api.php b/core/core.api.php index 7cb3814a92bb..dc1b6f6cb5fb 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -114,7 +114,7 @@ * and HAL. * - Node entity support is configured by default. If you would like to support * other types of entities, you can copy - * core/modules/rest/config/install/rest.settings.yml to your sync + * core/modules/hal/config/optional/rest.resource.entity.node.yml to your sync * configuration directory, appropriately modified for other entity types, * and import it. Support for GET on the log from the Database Logging module * can also be enabled in this way; in this case, the 'entity:node' line diff --git a/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php b/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php index 623d75c1c4f7..8f3b45ff822c 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentFieldFilterTest.php @@ -36,7 +36,7 @@ class CommentFieldFilterTest extends CommentTestBase { */ public $commentTitles = []; - protected function setUp($import_test_views = TRUE): void { + protected function setUp($import_test_views = TRUE, $modules = ['comment_test_views']): void { parent::setUp($import_test_views); $this->drupalLogin($this->drupalCreateUser(['access comments'])); diff --git a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php index eda163549779..830bf0bee99f 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php @@ -56,10 +56,10 @@ abstract class CommentTestBase extends ViewTestBase { */ protected $comment; - protected function setUp($import_test_views = TRUE) { + protected function setUp($import_test_views = TRUE, $modules = ['comment_test_views']) { parent::setUp($import_test_views); - ViewTestData::createTestViews(static::class, ['comment_test_views']); + ViewTestData::createTestViews(static::class, $modules); // Add two users, create a node with the user1 as author and another node // with user2 as author. For the second node add a comment from user1. diff --git a/core/modules/rest/config/optional/rest.resource.entity.node.yml b/core/modules/hal/config/optional/rest.resource.entity.node.yml similarity index 100% rename from core/modules/rest/config/optional/rest.resource.entity.node.yml rename to core/modules/hal/config/optional/rest.resource.entity.node.yml diff --git a/core/modules/hal/help_topics/hal.hal.html.twig b/core/modules/hal/help_topics/hal.hal.html.twig new file mode 100644 index 000000000000..1827733d0ec4 --- /dev/null +++ b/core/modules/hal/help_topics/hal.hal.html.twig @@ -0,0 +1,10 @@ +--- +label: 'Hypertext Application Language (HAL)' +top_level: true +related: + - core.web_services +--- +<h2>{% trans %}HAL module{% endtrans %}</h2> +<p>{% trans %}Adds support for serializing content entities using the JSON version of HAL.{% endtrans %}</p> +<h2>{% trans %}What is Hypertext Application Language (HAL)?{% endtrans %}</h2> +<p>{% trans %}<a href="https://stateless.co/hal_specification.html">Hypertext Application Language (HAL)</a> is a serialization format that supports linking, which enables web applications to follow links and explore relationships between the data and content items that are provided by the web service. Serialized HAL data can be provided in either JSON or XML format.{% endtrans %}</p> diff --git a/core/modules/hal/tests/modules/hal_test_views/hal_test_views.info.yml b/core/modules/hal/tests/modules/hal_test_views/hal_test_views.info.yml new file mode 100644 index 000000000000..67b23b6153a6 --- /dev/null +++ b/core/modules/hal/tests/modules/hal_test_views/hal_test_views.info.yml @@ -0,0 +1,8 @@ +name: 'HAL test views' +type: module +description: 'Provides default views for views HAL tests.' +package: Testing +version: VERSION +dependencies: + - drupal:rest + - drupal:views diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rest.yml b/core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_comment_hal.yml similarity index 99% rename from core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rest.yml rename to core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_comment_hal.yml index 31dd891ab7ce..0b1be7f4e4fb 100644 --- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_rest.yml +++ b/core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_comment_hal.yml @@ -9,7 +9,7 @@ dependencies: - rest - text - user -id: test_comment_rest +id: test_comment_hal label: 'Comments by node' module: views description: '' @@ -386,7 +386,6 @@ display: options: uses_fields: false formats: - json: json hal_json: hal_json row: type: data_field diff --git a/core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_serializer_display_entity.yml b/core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_serializer_display_entity.yml new file mode 100644 index 000000000000..9444338650fa --- /dev/null +++ b/core/modules/hal/tests/modules/hal_test_views/test_views/views.view.test_serializer_display_entity.yml @@ -0,0 +1,54 @@ +langcode: en +status: true +dependencies: + module: + - rest + - user +id: test_serializer_display_entity +label: 'Test serialize display entity rows' +module: rest +description: '' +tag: '' +base_table: entity_test +base_field: id +display: + default: + display_plugin: default + id: default + display_title: Default + position: null + display_options: + access: + type: perm + options: + perm: 'access content' + cache: + type: tag + query: + type: views_query + exposed_form: + type: basic + style: + type: serializer + row: + type: data_entity + sorts: + id: + id: standard + table: entity_test + field: id + order: DESC + plugin_id: date + entity_type: entity_test + entity_field: id + title: 'Test serialize' + arguments: { } + rest_export_1: + display_plugin: rest_export + id: rest_export_1 + display_title: serializer + position: null + display_options: + defaults: + access: false + path: test/serialize/entity diff --git a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonAnonTest.php index 1b781ea49104..bb97ccd53410 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\BaseFieldOverrideResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonBasicAuthTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonBasicAuthTest.php index 4c50b393ddc8..8dfb4ed6c30f 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\BaseFieldOverrideResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonCookieTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonCookieTest.php index afa7bfdbe4ea..0ea91c3b0073 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/BaseFieldOverrideHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/BaseFieldOverrideHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\BaseFieldOverrideResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonAnonTest.php index 4b30531c9ed3..a62dadb25823 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\DateFormatResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonBasicAuthTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonBasicAuthTest.php index ce1799f6cb6d..e42e5f90aafe 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\DateFormatResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonCookieTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonCookieTest.php index cab859896c5a..c9f182c33b00 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/DateFormatHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/DateFormatHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\DateFormatResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonAnonTest.php index 97aa324e89e1..d47d909f63cd 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormDisplayResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonBasicAuthTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonBasicAuthTest.php index 78f5539f3863..a0566b5a0d6f 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormDisplayResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonCookieTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonCookieTest.php index 8ff466c05549..05793e51817f 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormDisplayHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormDisplayHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormDisplayResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonAnonTest.php index 2ae1c8e08dd1..1a6f256ac64a 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormModeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonBasicAuthTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonBasicAuthTest.php index a5500ce4a4a3..b0cc2d1b953b 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormModeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonCookieTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonCookieTest.php index 298785506d7f..487bab7fce0e 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityFormModeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityFormModeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityFormModeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonAnonTest.php index 8daea2ecdb1e..f21fa0110907 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonBasicAuthTest.php similarity index 90% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonBasicAuthTest.php index a269c032d747..dc5cd151917d 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonCookieTest.php similarity index 88% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonCookieTest.php index a45e86265d06..c6bfd01c062a 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewDisplayHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewDisplayHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonAnonTest.php similarity index 92% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonAnonTest.php index f7bdd7356abf..a352b8742a2f 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonBasicAuthTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonBasicAuthTest.php index 1b829376c9f8..c4b967f84791 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonCookieTest.php similarity index 93% rename from core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonCookieTest.php index 55c72de5c38c..1dffe7bd6d7f 100644 --- a/core/tests/Drupal/FunctionalTests/Hal/EntityViewModeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/Core/EntityViewModeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\FunctionalTests\Hal; +namespace Drupal\Tests\hal\Functional\Core; use Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonAnonTest.php similarity index 86% rename from core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonAnonTest.php index 834cf5dd1d7e..cb3a62cb319d 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonBasicAuthTest.php index 4085a9a50ccf..12b29b0cb9ed 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonCookieTest.php similarity index 86% rename from core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonCookieTest.php index 8aa7a07c3e42..f84c83a29058 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonTestBase.php b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonTestBase.php similarity index 96% rename from core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonTestBase.php rename to core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonTestBase.php index 22357bf0f4b9..b8a10a7790eb 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/FeedHalJsonTestBase.php +++ b/core/modules/hal/tests/src/Functional/aggregator/FeedHalJsonTestBase.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\aggregator\Functional\Rest\FeedResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonAnonTest.php similarity index 90% rename from core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonAnonTest.php index fe6018133e05..09a36637a7ec 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonBasicAuthTest.php similarity index 92% rename from core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonBasicAuthTest.php index 2e696760f60e..547bd8147773 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonCookieTest.php similarity index 91% rename from core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonCookieTest.php index da07a955948c..1a722419a54b 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonTestBase.php b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonTestBase.php similarity index 98% rename from core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonTestBase.php rename to core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonTestBase.php index 207ff1eba714..13abfccf4ef5 100644 --- a/core/modules/aggregator/tests/src/Functional/Hal/ItemHalJsonTestBase.php +++ b/core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonTestBase.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\aggregator\Functional\Hal; +namespace Drupal\Tests\hal\Functional\aggregator; use Drupal\aggregator\Entity\Feed; use Drupal\Tests\aggregator\Functional\Rest\ItemResourceTestBase; diff --git a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/block/BlockHalJsonAnonTest.php similarity index 92% rename from core/modules/block/tests/src/Functional/Hal/BlockHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/block/BlockHalJsonAnonTest.php index 8de609d11e68..32c6f47d7dce 100644 --- a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/block/BlockHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block; use Drupal\Tests\block\Functional\Rest\BlockResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/block/BlockHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/block/tests/src/Functional/Hal/BlockHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/block/BlockHalJsonBasicAuthTest.php index 7cea1b6f8452..19caf71700fe 100644 --- a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/block/BlockHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block; use Drupal\Tests\block\Functional\Rest\BlockResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/block/BlockHalJsonCookieTest.php similarity index 93% rename from core/modules/block/tests/src/Functional/Hal/BlockHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/block/BlockHalJsonCookieTest.php index 5d7725671f45..a0be8f5fede5 100644 --- a/core/modules/block/tests/src/Functional/Hal/BlockHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/block/BlockHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block; use Drupal\Tests\block\Functional\Rest\BlockResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonAnonTest.php similarity index 97% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonAnonTest.php index 9e8d0ff2affc..a42b690a92ca 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Core\Cache\Cache; use Drupal\Tests\block_content\Functional\Rest\BlockContentResourceTestBase; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonBasicAuthTest.php similarity index 88% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonBasicAuthTest.php index d8716a185b58..289f5d722c2a 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonCookieTest.php similarity index 86% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonCookieTest.php index a751dae70c2b..839e172f777f 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonAnonTest.php similarity index 91% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonAnonTest.php index 2213bda7f4ee..eb32fac98d0b 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Tests\block_content\Functional\Rest\BlockContentTypeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonBasicAuthTest.php similarity index 92% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonBasicAuthTest.php index e823dcf23f9f..3dfe343d5be4 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Tests\block_content\Functional\Rest\BlockContentTypeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonCookieTest.php similarity index 92% rename from core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonCookieTest.php index 86ed15cc96bb..43aae05832ae 100644 --- a/core/modules/block_content/tests/src/Functional/Hal/BlockContentTypeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/block_content/BlockContentTypeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\block_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\block_content; use Drupal\Tests\block_content\Functional\Rest\BlockContentTypeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonAnonTest.php similarity index 94% rename from core/modules/comment/tests/src/Functional/Hal/CommentHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentHalJsonAnonTest.php index 01e069623e13..a4c01b0621ed 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/comment/tests/src/Functional/Hal/CommentHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentHalJsonBasicAuthTest.php index ee0ea2ee7fc6..700e784c9eab 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonCookieTest.php similarity index 87% rename from core/modules/comment/tests/src/Functional/Hal/CommentHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentHalJsonCookieTest.php index dd67cf6f2b7f..2390d7858f3b 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonTestBase.php b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonTestBase.php similarity index 98% rename from core/modules/comment/tests/src/Functional/Hal/CommentHalJsonTestBase.php rename to core/modules/hal/tests/src/Functional/comment/CommentHalJsonTestBase.php index 3f1363389623..e6396b8fc361 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentHalJsonTestBase.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentHalJsonTestBase.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\entity_test\Entity\EntityTest; use Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonAnonTest.php similarity index 92% rename from core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonAnonTest.php index 38c4ea324383..436db8391f55 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonBasicAuthTest.php index ca9b1c90f60a..14b41728a8ba 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonCookieTest.php similarity index 93% rename from core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonCookieTest.php index a5568ab4ef68..e8420554c97d 100644 --- a/core/modules/comment/tests/src/Functional/Hal/CommentTypeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/comment/CommentTypeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Functional\Hal; +namespace Drupal\Tests\hal\Functional\comment; use Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php b/core/modules/hal/tests/src/Functional/comment/Views/CommentHalExportTest.php similarity index 81% rename from core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php rename to core/modules/hal/tests/src/Functional/comment/Views/CommentHalExportTest.php index 8253dcb43b90..39f01f48fd3b 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php +++ b/core/modules/hal/tests/src/Functional/comment/Views/CommentHalExportTest.php @@ -1,16 +1,17 @@ <?php -namespace Drupal\Tests\comment\Functional\Views; +namespace Drupal\Tests\hal\Functional\comment\Views; use Drupal\Component\Serialization\Json; use Drupal\comment\Entity\Comment; +use Drupal\Tests\comment\Functional\Views\CommentTestBase; /** * Tests a comment rest export view. * - * @group comment + * @group hal */ -class CommentRestExportTest extends CommentTestBase { +class CommentHalExportTest extends CommentTestBase { /** * {@inheritdoc} @@ -22,7 +23,7 @@ class CommentRestExportTest extends CommentTestBase { * * @var array */ - public static $testViews = ['test_comment_rest']; + public static $testViews = ['test_comment_hal']; /** * {@inheritdoc} @@ -30,13 +31,13 @@ class CommentRestExportTest extends CommentTestBase { protected static $modules = [ 'node', 'comment', - 'comment_test_views', + 'hal_test_views', 'rest', 'hal', ]; - protected function setUp($import_test_views = TRUE): void { - parent::setUp($import_test_views); + protected function setUp($import_test_views = TRUE, $modules = ['hal_test_views']): void { + parent::setUp($import_test_views, $modules); // Add another anonymous comment. $comment = [ 'uid' => 0, diff --git a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonAnonTest.php similarity index 91% rename from core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonAnonTest.php index 5f2b25974f33..6aaaf4a7727d 100644 --- a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\config_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\config; use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonBasicAuthTest.php similarity index 92% rename from core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonBasicAuthTest.php index 990c6fb84c7b..12e2af6661f3 100644 --- a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\config_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\config; use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonCookieTest.php similarity index 92% rename from core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonCookieTest.php index 07025015b328..94527d70c62f 100644 --- a/core/modules/config/tests/config_test/tests/src/Functional/Hal/ConfigTestHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/config/ConfigTestHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\config_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\config; use Drupal\Tests\config_test\Functional\Rest\ConfigTestResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonAnonTest.php similarity index 92% rename from core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonAnonTest.php index 0f36180d6dd2..235d74ff578b 100644 --- a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\contact\Functional\Rest\ContactFormResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonBasicAuthTest.php index 8fdc32186871..735e5914cb7c 100644 --- a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\contact\Functional\Rest\ContactFormResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonCookieTest.php similarity index 93% rename from core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonCookieTest.php index 35866c0e8244..d2024e3680c2 100644 --- a/core/modules/contact/tests/src/Functional/Hal/ContactFormHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/contact/ContactFormHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\contact\Functional\Rest\ContactFormResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonAnonTest.php similarity index 95% rename from core/modules/contact/tests/src/Functional/Hal/MessageHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/contact/MessageHalJsonAnonTest.php index 5dc42402c742..c5f9a73a073f 100644 --- a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\contact\Functional\Rest\MessageResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/contact/tests/src/Functional/Hal/MessageHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/contact/MessageHalJsonBasicAuthTest.php index 961b99237f2b..547ae5cf4be5 100644 --- a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonCookieTest.php similarity index 87% rename from core/modules/contact/tests/src/Functional/Hal/MessageHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/contact/MessageHalJsonCookieTest.php index 2d93a661c0fa..7f2b17827f68 100644 --- a/core/modules/contact/tests/src/Functional/Hal/MessageHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/contact/MessageHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\contact\Functional\Hal; +namespace Drupal\Tests\hal\Functional\contact; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php b/core/modules/hal/tests/src/Functional/dblog/DbLogResourceTest.php similarity index 98% rename from core/modules/dblog/tests/src/Functional/DbLogResourceTest.php rename to core/modules/hal/tests/src/Functional/dblog/DbLogResourceTest.php index 4294949ef995..e8c449141d82 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogResourceTest.php +++ b/core/modules/hal/tests/src/Functional/dblog/DbLogResourceTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\dblog\Functional; +namespace Drupal\Tests\hal\Functional\dblog; use Drupal\Component\Serialization\Json; use Drupal\Core\Database\Database; @@ -11,7 +11,7 @@ /** * Tests the watchdog database log resource. * - * @group dblog + * @group hal */ class DbLogResourceTest extends ResourceTestBase { diff --git a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonAnonTest.php similarity index 92% rename from core/modules/editor/tests/src/Functional/Hal/EditorHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/editor/EditorHalJsonAnonTest.php index d4523d5273dd..ceb92812ea67 100644 --- a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\editor\Functional\Hal; +namespace Drupal\Tests\hal\Functional\editor; use Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/editor/tests/src/Functional/Hal/EditorHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/editor/EditorHalJsonBasicAuthTest.php index 21ef9b701b55..758446e5dcb6 100644 --- a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\editor\Functional\Hal; +namespace Drupal\Tests\hal\Functional\editor; use Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonCookieTest.php similarity index 93% rename from core/modules/editor/tests/src/Functional/Hal/EditorHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/editor/EditorHalJsonCookieTest.php index 5bb6f2215e36..647080a27240 100644 --- a/core/modules/editor/tests/src/Functional/Hal/EditorHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/editor/EditorHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\editor\Functional\Hal; +namespace Drupal\Tests\hal\Functional\editor; use Drupal\Tests\editor\Functional\Rest\EditorResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonAnonTest.php similarity index 93% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonAnonTest.php index 032b885aad74..abe8e656f853 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestBundleResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonBasicAuthTest.php index 7f7a502b3585..797b384bb5c9 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestBundleResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonCookieTest.php similarity index 92% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonCookieTest.php index d1dc648911ea..02fe14b6ec94 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestBundleHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestBundleHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestBundleResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonAnonTest.php similarity index 97% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonAnonTest.php index bae772cbd94e..7e8d87a1e003 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonBasicAuthTest.php index 505251835c26..da1c57e89383 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonCookieTest.php similarity index 86% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonCookieTest.php index 10bf4a1ca2cc..9937120c8c15 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonInternalPropertyNormalizerTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonInternalPropertyNormalizerTest.php similarity index 98% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonInternalPropertyNormalizerTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonInternalPropertyNormalizerTest.php index 65437c6b77ca..2b5a9ed9398c 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonInternalPropertyNormalizerTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonInternalPropertyNormalizerTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Core\Cache\Cache; use Drupal\field\Entity\FieldConfig; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonAnonTest.php similarity index 98% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonAnonTest.php index 2204d72f08d3..efbeea4eb502 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestLabelResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonBasicAuthTest.php index fd2a59c4a5e4..7b22e80f05f9 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonCookieTest.php similarity index 87% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonCookieTest.php index f46f586a35e2..def0d9c5e6f2 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestLabelHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestMapFieldHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/entity_test/EntityTestMapFieldHalJsonAnonTest.php similarity index 98% rename from core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestMapFieldHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/entity_test/EntityTestMapFieldHalJsonAnonTest.php index 27f30dda972c..80b91254a053 100644 --- a/core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestMapFieldHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/entity_test/EntityTestMapFieldHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\entity_test\Functional\Hal; +namespace Drupal\Tests\hal\Functional\entity_test; use Drupal\Tests\entity_test\Functional\Rest\EntityTestMapFieldResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonAnonTest.php similarity index 92% rename from core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonAnonTest.php index aabf6bd5c6b6..841ec9f158f5 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldConfigResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonBasicAuthTest.php index 458f0d5cb175..7c85d108e6f0 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldConfigResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonCookieTest.php similarity index 93% rename from core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonCookieTest.php index 5bb1dd905621..ea7deed35460 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldConfigHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldConfigHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldConfigResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonAnonTest.php similarity index 92% rename from core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonAnonTest.php index 2423375d32a8..4eba35dd893b 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldStorageConfigResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonBasicAuthTest.php index 94c2d8a4d450..5a748f1045d3 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldStorageConfigResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonCookieTest.php similarity index 93% rename from core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonCookieTest.php index a8a708503534..772017c0e443 100644 --- a/core/modules/field/tests/src/Functional/Hal/FieldStorageConfigHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/field/FieldStorageConfigHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\field\Functional\Hal; +namespace Drupal\Tests\hal\Functional\field; use Drupal\Tests\field\Functional\Rest\FieldStorageConfigResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/file/FileHalJsonAnonTest.php similarity index 98% rename from core/modules/file/tests/src/Functional/Hal/FileHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/file/FileHalJsonAnonTest.php index cd9dcac8f5c4..3f7ab6f62e97 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/file/FileHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\file\Functional\Rest\FileResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/file/FileHalJsonBasicAuthTest.php similarity index 90% rename from core/modules/file/tests/src/Functional/Hal/FileHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/file/FileHalJsonBasicAuthTest.php index 494fbf1ae972..27547a2005fa 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/file/FileHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/file/FileHalJsonCookieTest.php similarity index 87% rename from core/modules/file/tests/src/Functional/Hal/FileHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/file/FileHalJsonCookieTest.php index 47abaf3a3c01..9f05beff85db 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/file/FileHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonBasicAuthTest.php similarity index 90% rename from core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/file/FileUploadHalJsonBasicAuthTest.php index aa884d428b91..f03f934a9213 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonCookieTest.php similarity index 88% rename from core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/file/FileUploadHalJsonCookieTest.php index b9937c09a512..c5ac1c1be57e 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonTestBase.php b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonTestBase.php similarity index 98% rename from core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonTestBase.php rename to core/modules/hal/tests/src/Functional/file/FileUploadHalJsonTestBase.php index f7491213891f..cadd2bd7114c 100644 --- a/core/modules/file/tests/src/Functional/Hal/FileUploadHalJsonTestBase.php +++ b/core/modules/hal/tests/src/Functional/file/FileUploadHalJsonTestBase.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\file\Functional\Hal; +namespace Drupal\Tests\hal\Functional\file; use Drupal\Tests\rest\Functional\FileUploadResourceTestBase; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonAnonTest.php similarity index 92% rename from core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonAnonTest.php index d7425687c182..ee85168cd41a 100644 --- a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\filter\Functional\Hal; +namespace Drupal\Tests\hal\Functional\filter; use Drupal\Tests\filter\Functional\Rest\FilterFormatResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonBasicAuthTest.php index 67e0fff94b08..a4750a030a1d 100644 --- a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\filter\Functional\Hal; +namespace Drupal\Tests\hal\Functional\filter; use Drupal\Tests\filter\Functional\Rest\FilterFormatResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonCookieTest.php similarity index 93% rename from core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonCookieTest.php index 59906b475b0b..07faf62c7ac5 100644 --- a/core/modules/filter/tests/src/Functional/Hal/FilterFormatHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/filter/FilterFormatHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\filter\Functional\Hal; +namespace Drupal\Tests\hal\Functional\filter; use Drupal\Tests\filter\Functional\Rest\FilterFormatResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonAnonTest.php similarity index 92% rename from core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonAnonTest.php index 3d470cd4d6dc..0404caea798b 100644 --- a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\image; use Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonBasicAuthTest.php index c834b846ba5c..ef914a95cb00 100644 --- a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\image; use Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonCookieTest.php similarity index 93% rename from core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonCookieTest.php index 21801ebdbd40..430bea146fd1 100644 --- a/core/modules/image/tests/src/Functional/Hal/ImageStyleHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/image/ImageStyleHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\image; use Drupal\Tests\image\Functional\Rest\ImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonAnonTest.php similarity index 92% rename from core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonAnonTest.php index 06a98c756120..f6577108dbcb 100644 --- a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ConfigurableLanguageResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonBasicAuthTest.php index 20c3d75d7707..6c5aafe0f779 100644 --- a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ConfigurableLanguageResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonCookieTest.php similarity index 93% rename from core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonCookieTest.php index 6af58e060b0c..f87a20347bb5 100644 --- a/core/modules/language/tests/src/Functional/Hal/ConfigurableLanguageHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/language/ConfigurableLanguageHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ConfigurableLanguageResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonAnonTest.php similarity index 92% rename from core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonAnonTest.php index 8202050df780..84d378d3257d 100644 --- a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ContentLanguageSettingsResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonBasicAuthTest.php index f59e1b8442e9..ec94ebda2206 100644 --- a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ContentLanguageSettingsResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonCookieTest.php similarity index 93% rename from core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonCookieTest.php index 5a14838d78d8..7511b86929a6 100644 --- a/core/modules/language/tests/src/Functional/Hal/ContentLanguageSettingsHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/language/ContentLanguageSettingsHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\language\Functional\Hal; +namespace Drupal\Tests\hal\Functional\language; use Drupal\Tests\language\Functional\Rest\ContentLanguageSettingsResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php similarity index 86% rename from core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php index 95c66ddb09d8..9bab0a222267 100644 --- a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonAnonTest.php @@ -1,13 +1,12 @@ <?php -namespace Drupal\Tests\layout_builder\Functional\Hal; +namespace Drupal\Tests\hal\Functional\layout_builder; use Drupal\Tests\layout_builder\Functional\Rest\LayoutBuilderEntityViewDisplayResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; /** - * @group layout_builder - * @group rest + * @group hal */ class LayoutBuilderEntityViewDisplayHalJsonAnonTest extends LayoutBuilderEntityViewDisplayResourceTestBase { diff --git a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php similarity index 69% rename from core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php index 6721bfaa0254..7ad4481103eb 100644 --- a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest.php @@ -1,13 +1,12 @@ <?php -namespace Drupal\Tests\layout_builder\Functional\Hal; +namespace Drupal\Tests\hal\Functional\layout_builder; -use Drupal\FunctionalTests\Hal\EntityViewDisplayHalJsonAnonTest; +use Drupal\Tests\hal\Functional\Core\EntityViewDisplayHalJsonAnonTest; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; /** - * @group layout_builder - * @group rest + * @group hal */ class LayoutBuilderEntityViewDisplayHalJsonBasicAuthTest extends EntityViewDisplayHalJsonAnonTest { diff --git a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php similarity index 79% rename from core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php index ad272d297e6a..b70b1f4b1347 100644 --- a/core/modules/layout_builder/tests/src/Functional/Hal/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/layout_builder/LayoutBuilderEntityViewDisplayHalJsonCookieTest.php @@ -1,12 +1,11 @@ <?php -namespace Drupal\Tests\layout_builder\Functional\Hal; +namespace Drupal\Tests\hal\Functional\layout_builder; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; /** - * @group layout_builder - * @group rest + * @group hal */ class LayoutBuilderEntityViewDisplayHalJsonCookieTest extends LayoutBuilderEntityViewDisplayHalJsonAnonTest { diff --git a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/media/MediaHalJsonAnonTest.php similarity index 99% rename from core/modules/media/tests/src/Functional/Hal/MediaHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/media/MediaHalJsonAnonTest.php index f1c0ce3af26b..f19839fe9af2 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\file\Entity\File; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/media/MediaHalJsonBasicAuthTest.php similarity index 90% rename from core/modules/media/tests/src/Functional/Hal/MediaHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/media/MediaHalJsonBasicAuthTest.php index d44534890a55..9739eb65f533 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/media/MediaHalJsonCookieTest.php similarity index 87% rename from core/modules/media/tests/src/Functional/Hal/MediaHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/media/MediaHalJsonCookieTest.php index 16a76ec71b2e..b6d036db711b 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonAnonTest.php similarity index 92% rename from core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonAnonTest.php index 6d28e5d3a38e..e7fc765ac5a2 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\Tests\media\Functional\Rest\MediaTypeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonBasicAuthTest.php index 80e12e66d19d..a006862911bf 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\Tests\media\Functional\Rest\MediaTypeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonCookieTest.php similarity index 93% rename from core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonCookieTest.php index c50b78093d68..c51b365a6f26 100644 --- a/core/modules/media/tests/src/Functional/Hal/MediaTypeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/media/MediaTypeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\media\Functional\Hal; +namespace Drupal\Tests\hal\Functional\media; use Drupal\Tests\media\Functional\Rest\MediaTypeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonAnonTest.php similarity index 96% rename from core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonAnonTest.php index d819850453c9..8a603fc419af 100644 --- a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\menu_link_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\menu_link_content; use Drupal\Core\Cache\Cache; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonBasicAuthTest.php similarity index 88% rename from core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonBasicAuthTest.php index dc4997261b94..e60fb72fc1d1 100644 --- a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\menu_link_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\menu_link_content; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonCookieTest.php similarity index 85% rename from core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonCookieTest.php index aeb7d858e8a3..7ec644b6f98a 100644 --- a/core/modules/menu_link_content/tests/src/Functional/Hal/MenuLinkContentHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/menu_link_content/MenuLinkContentHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\menu_link_content\Functional\Hal; +namespace Drupal\Tests\hal\Functional\menu_link_content; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/node/NodeHalJsonAnonTest.php similarity index 98% rename from core/modules/node/tests/src/Functional/Hal/NodeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/node/NodeHalJsonAnonTest.php index 0f12461524ea..c36e35b08148 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; use Drupal\Tests\node\Functional\Rest\NodeResourceTestBase; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/node/NodeHalJsonBasicAuthTest.php similarity index 90% rename from core/modules/node/tests/src/Functional/Hal/NodeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/node/NodeHalJsonBasicAuthTest.php index 50851bbd1497..7ed8039defba 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/node/NodeHalJsonCookieTest.php similarity index 87% rename from core/modules/node/tests/src/Functional/Hal/NodeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/node/NodeHalJsonCookieTest.php index 1c49e78c7d4f..71e5471688ca 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonAnonTest.php similarity index 92% rename from core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonAnonTest.php index e2920829a77c..7acdc7fb67cb 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\node\Functional\Rest\NodeTypeResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonBasicAuthTest.php index b1f90b68687c..a0448e1c663e 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\node\Functional\Rest\NodeTypeResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonCookieTest.php similarity index 93% rename from core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonCookieTest.php index 3c5b821446dd..b20cc3e9c2bf 100644 --- a/core/modules/node/tests/src/Functional/Hal/NodeTypeHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/node/NodeTypeHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Functional\Hal; +namespace Drupal\Tests\hal\Functional\node; use Drupal\Tests\node\Functional\Rest\NodeTypeResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/hal/tests/src/Functional/page_cache/PageCacheTest.php b/core/modules/hal/tests/src/Functional/page_cache/PageCacheTest.php new file mode 100644 index 000000000000..4aaaab6166a4 --- /dev/null +++ b/core/modules/hal/tests/src/Functional/page_cache/PageCacheTest.php @@ -0,0 +1,133 @@ +<?php + +namespace Drupal\Tests\hal\Functional\page_cache; + +use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; + +/** + * Enables the page cache and tests it with various HTTP requests. + * + * @group hal + */ +class PageCacheTest extends BrowserTestBase { + + use AssertPageCacheContextsAndTagsTrait; + + protected $dumpHeaders = TRUE; + + /** + * Modules to enable. + * + * @var array + */ + protected static $modules = ['test_page_test', 'system_test', 'entity_test']; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + $this->config('system.site') + ->set('name', 'Drupal') + ->set('page.front', '/test-page') + ->save(); + } + + /** + * Tests support for different cache items with different request formats. + * + * Request formats are specified via a query parameter. + */ + public function testQueryParameterFormatRequests() { + $config = $this->config('system.performance'); + $config->set('cache.page.max_age', 300); + $config->save(); + + // Enable REST support for nodes and hal+json. + \Drupal::service('module_installer')->install([ + 'node', + 'hal', + 'rest', + 'basic_auth', + ]); + $this->drupalCreateContentType(['type' => 'article']); + $node = $this->drupalCreateNode(['type' => 'article']); + $node_uri = $node->toUrl(); + $node_url_with_hal_json_format = $node->toUrl('canonical')->setRouteParameter('_format', 'hal_json'); + + $this->drupalGet($node_uri); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); + $this->drupalGet($node_uri); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); + + // Now request a HAL page twice, we expect that the first request is a cache + // miss and both requests serve 'application/hal+json'. + $this->drupalGet($node_url_with_hal_json_format); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); + $this->drupalGet($node_url_with_hal_json_format); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); + + // Clear the page cache. After that request a double HAL request, followed + // by two ordinary HTML ones. + \Drupal::cache('page')->deleteAll(); + $this->drupalGet($node_url_with_hal_json_format); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); + $this->drupalGet($node_url_with_hal_json_format); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); + + $this->drupalGet($node_uri); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); + $this->drupalGet($node_uri); + $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); + } + + /** + * Retrieves only the headers for an absolute path. + * + * Executes a cURL request without any modifications to the given URL. + * Note that Guzzle always normalizes URLs which prevents testing all + * possible edge cases. + * + * @param string $url + * URL to request. + * + * @return array + * Array of headers. + */ + protected function getHeaders($url) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HEADER, TRUE); + curl_setopt($ch, CURLOPT_NOBODY, TRUE); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_USERAGENT, drupal_generate_test_ua($this->databasePrefix)); + $output = curl_exec($ch); + curl_close($ch); + + $headers = []; + foreach (explode("\n", $output) as $header) { + if (strpos($header, ':')) { + [$key, $value] = explode(':', $header, 2); + $headers[trim($key)] = trim($value); + } + } + + return $headers; + } + +} diff --git a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonAnonTest.php similarity index 87% rename from core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonAnonTest.php index 456d33d6161e..3d6d4771e4cd 100644 --- a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonAnonTest.php @@ -1,12 +1,11 @@ <?php -namespace Drupal\Tests\path_alias\Functional\Hal; +namespace Drupal\Tests\hal\Functional\path_alias; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; /** * @group hal - * @group path_alias */ class PathAliasHalJsonAnonTest extends PathAliasHalJsonTestBase { diff --git a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonBasicAuthTest.php index 23dc427ef9a7..fa588d17ab17 100644 --- a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonBasicAuthTest.php @@ -1,12 +1,11 @@ <?php -namespace Drupal\Tests\path_alias\Functional\Hal; +namespace Drupal\Tests\hal\Functional\path_alias; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; /** * @group hal - * @group path_alias */ class PathAliasHalJsonBasicAuthTest extends PathAliasHalJsonTestBase { diff --git a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonCookieTest.php similarity index 88% rename from core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonCookieTest.php index e4567cd2b586..15f673b4b766 100644 --- a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonCookieTest.php @@ -1,12 +1,11 @@ <?php -namespace Drupal\Tests\path_alias\Functional\Hal; +namespace Drupal\Tests\hal\Functional\path_alias; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; /** * @group hal - * @group path_alias */ class PathAliasHalJsonCookieTest extends PathAliasHalJsonTestBase { diff --git a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonTestBase.php b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonTestBase.php similarity index 96% rename from core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonTestBase.php rename to core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonTestBase.php index 69874cfecd83..809ab20b7e7a 100644 --- a/core/modules/path_alias/tests/src/Functional/Hal/PathAliasHalJsonTestBase.php +++ b/core/modules/hal/tests/src/Functional/path_alias/PathAliasHalJsonTestBase.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\path_alias\Functional\Hal; +namespace Drupal\Tests\hal\Functional\path_alias; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; use Drupal\Tests\path_alias\Functional\Rest\PathAliasResourceTestBase; diff --git a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonAnonTest.php similarity index 92% rename from core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonAnonTest.php index 38d0ebeab635..37a6d79197b8 100644 --- a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rdf\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rdf; use Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonBasicAuthTest.php index 308cedff6a9f..a70cdcc8805c 100644 --- a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rdf\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rdf; use Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonCookieTest.php similarity index 93% rename from core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonCookieTest.php index 0d8f9e257c4c..aa36d9aae7e2 100644 --- a/core/modules/rdf/tests/src/Functional/Hal/RdfMappingHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/rdf/RdfMappingHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rdf\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rdf; use Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonAnonTest.php similarity index 91% rename from core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonAnonTest.php index bed419e9f6ae..9bf6301c88e0 100644 --- a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\responsive_image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\responsive_image; use Drupal\Tests\responsive_image\Functional\Rest\ResponsiveImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonBasicAuthTest.php similarity index 92% rename from core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonBasicAuthTest.php index 44b3a82c40cb..8887139d61cb 100644 --- a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\responsive_image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\responsive_image; use Drupal\Tests\responsive_image\Functional\Rest\ResponsiveImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonCookieTest.php similarity index 92% rename from core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonCookieTest.php index c3bd2a090371..1a3ce6772c4c 100644 --- a/core/modules/responsive_image/tests/src/Functional/Hal/ResponsiveImageStyleHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/responsive_image/ResponsiveImageStyleHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\responsive_image\Functional\Hal; +namespace Drupal\Tests\hal\Functional\responsive_image; use Drupal\Tests\responsive_image\Functional\Rest\ResponsiveImageStyleResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonAnonTest.php similarity index 92% rename from core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonAnonTest.php index 6e67a9e0cbb7..5b2f224660e9 100644 --- a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rest\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rest; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\rest\Functional\Rest\RestResourceConfigResourceTestBase; diff --git a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonBasicAuthTest.php index 22fbc9d68722..82763e033bb2 100644 --- a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rest\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rest; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\rest\Functional\Rest\RestResourceConfigResourceTestBase; diff --git a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonCookieTest.php similarity index 93% rename from core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonCookieTest.php index 062682638e85..a9c88853c768 100644 --- a/core/modules/rest/tests/src/Functional/Hal/RestResourceConfigHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/rest/RestResourceConfigHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\rest\Functional\Hal; +namespace Drupal\Tests\hal\Functional\rest; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\rest\Functional\Rest\RestResourceConfigResourceTestBase; diff --git a/core/modules/hal/tests/src/Functional/rest/Views/StyleSerializerTest.php b/core/modules/hal/tests/src/Functional/rest/Views/StyleSerializerTest.php new file mode 100644 index 000000000000..d83aa4e641ef --- /dev/null +++ b/core/modules/hal/tests/src/Functional/rest/Views/StyleSerializerTest.php @@ -0,0 +1,109 @@ +<?php + +namespace Drupal\Tests\hal\Functional\rest\Views; + +use Drupal\Core\Cache\Cache; +use Drupal\entity_test\Entity\EntityTest; +use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; +use Drupal\Tests\views\Functional\ViewTestBase; +use Drupal\views\Views; +use Drupal\views\Tests\ViewTestData; + +/** + * Tests the serializer style plugin. + * + * @group hal + * @see \Drupal\rest\Plugin\views\display\RestExport + * @see \Drupal\rest\Plugin\views\style\Serializer + * @see \Drupal\rest\Plugin\views\row\DataEntityRow + * @see \Drupal\rest\Plugin\views\row\DataFieldRow + */ +class StyleSerializerTest extends ViewTestBase { + + use AssertPageCacheContextsAndTagsTrait; + + /** + * Modules to install. + * + * @var array + */ + protected static $modules = [ + 'entity_test', + 'hal', + 'hal_test_views', + 'node', + ]; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * Views used by this test. + * + * @var array + */ + public static $testViews = ['test_serializer_display_entity']; + + /** + * A user with administrative privileges to look at test entity and configure views. + */ + protected $adminUser; + + /** + * The renderer. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + protected function setUp($import_test_views = TRUE): void { + parent::setUp($import_test_views); + + ViewTestData::createTestViews(static::class, ['hal_test_views']); + + $this->adminUser = $this->drupalCreateUser([ + 'administer entity_test content', + 'access user profiles', + 'view test entity', + ]); + + // Save some entity_test entities. + for ($i = 1; $i <= 10; $i++) { + EntityTest::create(['name' => 'test_' . $i, 'user_id' => $this->adminUser->id()])->save(); + } + + $this->enableViewsTestModule(); + } + + /** + * Checks the behavior of the Serializer callback paths and row plugins. + */ + public function testSerializerResponses() { + // Test the entity rows. + $view = Views::getView('test_serializer_display_entity'); + $view->initDisplay(); + $this->executeView($view); + + // Get the serializer service. + $serializer = $this->container->get('serializer'); + + $entities = []; + foreach ($view->result as $row) { + $entities[] = $row->_entity; + } + + $expected_cache_tags = $view->getCacheTags(); + $expected_cache_tags[] = 'entity_test_list'; + /** @var \Drupal\Core\Entity\EntityInterface $entity */ + foreach ($entities as $entity) { + $expected_cache_tags = Cache::mergeTags($expected_cache_tags, $entity->getCacheTags()); + } + $expected = $serializer->serialize($entities, 'hal_json'); + $actual_json = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'hal_json']]); + $this->assertSame($expected, $actual_json, 'The expected HAL output was found.'); + $this->assertCacheTags($expected_cache_tags); + } + +} diff --git a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonAnonTest.php similarity index 92% rename from core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/search/SearchPageHalJsonAnonTest.php index 8539bef5e510..178937b25761 100644 --- a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\search\Functional\Hal; +namespace Drupal\Tests\hal\Functional\search; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase; diff --git a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/search/SearchPageHalJsonBasicAuthTest.php index 276ac6bdfb2b..486f59f2d2d7 100644 --- a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\search\Functional\Hal; +namespace Drupal\Tests\hal\Functional\search; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase; diff --git a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonCookieTest.php similarity index 93% rename from core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/search/SearchPageHalJsonCookieTest.php index 8051df578296..e1a9514df428 100644 --- a/core/modules/search/tests/src/Functional/Hal/SearchPageHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/search/SearchPageHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\search\Functional\Hal; +namespace Drupal\Tests\hal\Functional\search; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\search\Functional\Rest\SearchPageResourceTestBase; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonAnonTest.php similarity index 97% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonAnonTest.php index 9d3006b2e9f9..3b7acd682e9b 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Core\Cache\Cache; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonBasicAuthTest.php index 09295a2f14a6..50d0a7946304 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonCookieTest.php similarity index 87% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonCookieTest.php index 01f152dd493b..12bebbad27f8 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonAnonTest.php similarity index 92% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonAnonTest.php index 4782b18ea4cc..2058c28352c5 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\shortcut\Functional\Rest\ShortcutSetResourceTestBase; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonBasicAuthTest.php index 4ee80a0ce16a..82debce16316 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonCookieTest.php similarity index 87% rename from core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonCookieTest.php index 9c8189965e24..9ea7a4ad1ba0 100644 --- a/core/modules/shortcut/tests/src/Functional/Hal/ShortcutSetHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/shortcut/ShortcutSetHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\shortcut\Functional\Hal; +namespace Drupal\Tests\hal\Functional\shortcut; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/system/ActionHalJsonAnonTest.php similarity index 92% rename from core/modules/system/tests/src/Functional/Hal/ActionHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/system/ActionHalJsonAnonTest.php index b425aec37e26..33331eb41552 100644 --- a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/system/ActionHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\system\Functional\Rest\ActionResourceTestBase; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/system/ActionHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/system/tests/src/Functional/Hal/ActionHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/system/ActionHalJsonBasicAuthTest.php index 55c84bf60635..c601103dcd8f 100644 --- a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/system/ActionHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\system\Functional\Rest\ActionResourceTestBase; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/system/ActionHalJsonCookieTest.php similarity index 93% rename from core/modules/system/tests/src/Functional/Hal/ActionHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/system/ActionHalJsonCookieTest.php index 8a35bc8ad3df..624f8aff08c5 100644 --- a/core/modules/system/tests/src/Functional/Hal/ActionHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/system/ActionHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\system\Functional\Rest\ActionResourceTestBase; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/system/MenuHalJsonAnonTest.php similarity index 92% rename from core/modules/system/tests/src/Functional/Hal/MenuHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/system/MenuHalJsonAnonTest.php index 356447e141bc..fbec680acab1 100644 --- a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/system/MenuHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\system\Functional\Rest\MenuResourceTestBase; diff --git a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/system/MenuHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/system/tests/src/Functional/Hal/MenuHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/system/MenuHalJsonBasicAuthTest.php index c5ea4652fd24..8c2713e2b3d2 100644 --- a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/system/MenuHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\system\Functional\Rest\MenuResourceTestBase; diff --git a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/system/MenuHalJsonCookieTest.php similarity index 93% rename from core/modules/system/tests/src/Functional/Hal/MenuHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/system/MenuHalJsonCookieTest.php index 4a064dfce404..f5bdd48fff3d 100644 --- a/core/modules/system/tests/src/Functional/Hal/MenuHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/system/MenuHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\system\Functional\Hal; +namespace Drupal\Tests\hal\Functional\system; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\system\Functional\Rest\MenuResourceTestBase; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonAnonTest.php similarity index 99% rename from core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonAnonTest.php index ff8d4e288901..dfe55ef67635 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\taxonomy\Entity\Term; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonBasicAuthTest.php index 626fba45ae1d..b1830a7b0055 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonCookieTest.php similarity index 86% rename from core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonCookieTest.php index face86285a48..4f6f49a66db9 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/TermHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/TermHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonAnonTest.php similarity index 93% rename from core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonAnonTest.php index b94677c7025c..97623154511a 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonBasicAuthTest.php index 044a73203507..4dcf9ea02ab2 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase; diff --git a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonCookieTest.php similarity index 92% rename from core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonCookieTest.php index c14248c42e7d..d47db42abd72 100644 --- a/core/modules/taxonomy/tests/src/Functional/Hal/VocabularyHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/taxonomy/VocabularyHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\taxonomy\Functional\Hal; +namespace Drupal\Tests\hal\Functional\taxonomy; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\taxonomy\Functional\Rest\VocabularyResourceTestBase; diff --git a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/tour/TourHalJsonAnonTest.php similarity index 92% rename from core/modules/tour/tests/src/Functional/Hal/TourHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/tour/TourHalJsonAnonTest.php index 14ed83c28bde..16fb1ec15053 100644 --- a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/tour/TourHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\tour\Functional\Hal; +namespace Drupal\Tests\hal\Functional\tour; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\tour\Functional\Rest\TourResourceTestBase; diff --git a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/tour/TourHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/tour/tests/src/Functional/Hal/TourHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/tour/TourHalJsonBasicAuthTest.php index ce311eb90baf..84aa433c89ef 100644 --- a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/tour/TourHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\tour\Functional\Hal; +namespace Drupal\Tests\hal\Functional\tour; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\tour\Functional\Rest\TourResourceTestBase; diff --git a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/tour/TourHalJsonCookieTest.php similarity index 93% rename from core/modules/tour/tests/src/Functional/Hal/TourHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/tour/TourHalJsonCookieTest.php index 855cff325670..a7804d640b74 100644 --- a/core/modules/tour/tests/src/Functional/Hal/TourHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/tour/TourHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\tour\Functional\Hal; +namespace Drupal\Tests\hal\Functional\tour; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\tour\Functional\Rest\TourResourceTestBase; diff --git a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php b/core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php similarity index 99% rename from core/modules/user/tests/src/Functional/RestRegisterUserTest.php rename to core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php index 14629c6776d3..f0534c8a33c6 100644 --- a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php +++ b/core/modules/hal/tests/src/Functional/user/RestRegisterUserTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Core\Url; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; @@ -12,7 +12,7 @@ /** * Tests user registration via REST resource. * - * @group user + * @group hal */ class RestRegisterUserTest extends ResourceTestBase { diff --git a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/user/RoleHalJsonAnonTest.php similarity index 92% rename from core/modules/user/tests/src/Functional/Hal/RoleHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/user/RoleHalJsonAnonTest.php index 4e32528bb4f4..52510591be46 100644 --- a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/user/RoleHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\user\Functional\Rest\RoleResourceTestBase; diff --git a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/user/RoleHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/user/tests/src/Functional/Hal/RoleHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/user/RoleHalJsonBasicAuthTest.php index 7ff1fd7f7051..4fb1f51dc3cf 100644 --- a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/user/RoleHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\user\Functional\Rest\RoleResourceTestBase; diff --git a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/user/RoleHalJsonCookieTest.php similarity index 93% rename from core/modules/user/tests/src/Functional/Hal/RoleHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/user/RoleHalJsonCookieTest.php index 9d0a62ea5839..fa21afd186e7 100644 --- a/core/modules/user/tests/src/Functional/Hal/RoleHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/user/RoleHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\user\Functional\Rest\RoleResourceTestBase; diff --git a/core/modules/user/tests/src/Functional/Hal/UserHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/user/UserHalJsonAnonTest.php similarity index 96% rename from core/modules/user/tests/src/Functional/Hal/UserHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/user/UserHalJsonAnonTest.php index 0e7202fa4173..72a84514e3e1 100644 --- a/core/modules/user/tests/src/Functional/Hal/UserHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/user/UserHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; diff --git a/core/modules/user/tests/src/Functional/Hal/UserHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/user/UserHalJsonBasicAuthTest.php similarity index 90% rename from core/modules/user/tests/src/Functional/Hal/UserHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/user/UserHalJsonBasicAuthTest.php index de75e2b45201..3ccb208cd8fb 100644 --- a/core/modules/user/tests/src/Functional/Hal/UserHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/user/UserHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/user/tests/src/Functional/Hal/UserHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/user/UserHalJsonCookieTest.php similarity index 87% rename from core/modules/user/tests/src/Functional/Hal/UserHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/user/UserHalJsonCookieTest.php index 2945db5a6ed7..aa60d6f1e6b1 100644 --- a/core/modules/user/tests/src/Functional/Hal/UserHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/user/UserHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\user\Functional\Hal; +namespace Drupal\Tests\hal\Functional\user; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/hal/tests/src/Functional/user/UserHalLoginHttpTest.php b/core/modules/hal/tests/src/Functional/user/UserHalLoginHttpTest.php new file mode 100644 index 000000000000..0d9bc99d4686 --- /dev/null +++ b/core/modules/hal/tests/src/Functional/user/UserHalLoginHttpTest.php @@ -0,0 +1,54 @@ +<?php + +namespace Drupal\Tests\hal\Functional\user; + +use Drupal\Tests\user\Functional\UserLoginHttpTest; +use GuzzleHttp\Cookie\CookieJar; +use Drupal\hal\Encoder\JsonEncoder as HALJsonEncoder; +use Symfony\Component\Serializer\Serializer; + +/** + * Tests login and password reset via direct HTTP in hal_json format. + * + * @group hal + */ +class UserHalLoginHttpTest extends UserLoginHttpTest { + + /** + * Modules to install. + * + * @var array + */ + protected static $modules = ['hal', 'dblog']; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + $this->cookies = new CookieJar(); + $encoders = [new HALJsonEncoder()]; + $this->serializer = new Serializer([], $encoders); + } + + /** + * {@inheritdoc} + */ + public function testLogin() { + $this->doTestLogin('hal_json'); + } + + /** + * {@inheritdoc} + */ + public function testPasswordReset() { + // Create a user account. + $account = $this->drupalCreateUser(); + + $this->doTestPasswordReset('hal_json', $account); + $this->doTestGlobalLoginFloodControl('hal_json'); + $this->doTestPerUserLoginFloodControl('hal_json'); + $this->doTestLogoutCsrfProtection('hal_json'); + } + +} diff --git a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/views/ViewHalJsonAnonTest.php similarity index 92% rename from core/modules/views/tests/src/Functional/Hal/ViewHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/views/ViewHalJsonAnonTest.php index 612474f95c5b..420b538c82ab 100644 --- a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/views/ViewHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\views\Functional\Hal; +namespace Drupal\Tests\hal\Functional\views; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase; diff --git a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/views/ViewHalJsonBasicAuthTest.php similarity index 93% rename from core/modules/views/tests/src/Functional/Hal/ViewHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/views/ViewHalJsonBasicAuthTest.php index 345955c5fa10..98f6c4fa8e28 100644 --- a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/views/ViewHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\views\Functional\Hal; +namespace Drupal\Tests\hal\Functional\views; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase; diff --git a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/views/ViewHalJsonCookieTest.php similarity index 93% rename from core/modules/views/tests/src/Functional/Hal/ViewHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/views/ViewHalJsonCookieTest.php index 2dd38bd513ed..068f35ea1962 100644 --- a/core/modules/views/tests/src/Functional/Hal/ViewHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/views/ViewHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\views\Functional\Hal; +namespace Drupal\Tests\hal\Functional\views; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; use Drupal\Tests\views\Functional\Rest\ViewResourceTestBase; diff --git a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonAnonTest.php b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonAnonTest.php similarity index 91% rename from core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonAnonTest.php rename to core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonAnonTest.php index 52f416f7aead..8d06e45924d6 100644 --- a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonAnonTest.php +++ b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonAnonTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\workflows\Functional\Hal; +namespace Drupal\Tests\hal\Functional\workflows; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; use Drupal\Tests\workflows\Functional\Rest\WorkflowResourceTestBase; diff --git a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonBasicAuthTest.php b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonBasicAuthTest.php similarity index 89% rename from core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonBasicAuthTest.php rename to core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonBasicAuthTest.php index c4b15c266966..1351de6d9118 100644 --- a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonBasicAuthTest.php +++ b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonBasicAuthTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\workflows\Functional\Hal; +namespace Drupal\Tests\hal\Functional\workflows; use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait; diff --git a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonCookieTest.php b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonCookieTest.php similarity index 87% rename from core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonCookieTest.php rename to core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonCookieTest.php index db1a75c1d120..856a3a3a3222 100644 --- a/core/modules/workflows/tests/src/Functional/Hal/WorkflowHalJsonCookieTest.php +++ b/core/modules/hal/tests/src/Functional/workflows/WorkflowHalJsonCookieTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\workflows\Functional\Hal; +namespace Drupal\Tests\hal\Functional\workflows; use Drupal\Tests\rest\Functional\CookieResourceTestTrait; diff --git a/core/modules/serialization/tests/src/Kernel/EntityResolverTest.php b/core/modules/hal/tests/src/Kernel/EntityResolverTest.php similarity index 95% rename from core/modules/serialization/tests/src/Kernel/EntityResolverTest.php rename to core/modules/hal/tests/src/Kernel/EntityResolverTest.php index 0b687306f0b0..d6517ccb115d 100644 --- a/core/modules/serialization/tests/src/Kernel/EntityResolverTest.php +++ b/core/modules/hal/tests/src/Kernel/EntityResolverTest.php @@ -1,16 +1,17 @@ <?php -namespace Drupal\Tests\serialization\Kernel; +namespace Drupal\Tests\hal\Kernel; use Drupal\Core\Url; use Drupal\entity_test\Entity\EntityTestMulRev; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\Tests\serialization\Kernel\NormalizerTestBase; /** * Tests that entities references can be resolved. * - * @group serialization + * @group hal */ class EntityResolverTest extends NormalizerTestBase { diff --git a/core/modules/hal/tests/src/Kernel/EntityResource/EntityResourceHalTestCoverageTest.php b/core/modules/hal/tests/src/Kernel/EntityResource/EntityResourceHalTestCoverageTest.php new file mode 100644 index 000000000000..583d9915faeb --- /dev/null +++ b/core/modules/hal/tests/src/Kernel/EntityResource/EntityResourceHalTestCoverageTest.php @@ -0,0 +1,118 @@ +<?php + +namespace Drupal\Tests\hal\Kernel\EntityResource; + +use Drupal\Core\Config\Entity\ConfigEntityInterface; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Extension\ExtensionLifecycle; +use Drupal\KernelTests\KernelTestBase; +use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase; + +/** + * Checks that all core content/config entity types have HAL test coverage. + * + * Every entity type must have test coverage for: + * - hal_json + * - every authentication provider in core (anon, cookie, basic_auth) + * + * Additionally, every entity type must have the correct parent test class. + * + * @group hal + */ +class EntityResourceHalTestCoverageTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['system', 'user']; + + /** + * Entity definitions array. + * + * @var array + */ + protected $definitions; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + $all_modules = $this->container->get('extension.list.module')->getList(); + $stable_core_modules = array_filter($all_modules, function ($module) { + // Filter out contrib, hidden, testing, and experimental modules. We also + // don't need to enable modules that are already enabled. + return $module->origin === 'core' && + empty($module->info['hidden']) && + $module->status == FALSE && + $module->info['package'] !== 'Testing' && + $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] !== ExtensionLifecycle::EXPERIMENTAL; + }); + + $this->container->get('module_installer')->install(array_keys($stable_core_modules)); + + $this->definitions = $this->container->get('entity_type.manager')->getDefinitions(); + + // Entity types marked as "internal" are not exposed by the entity REST + // resource plugin and hence also don't need test coverage. + $this->definitions = array_filter($this->definitions, function (EntityTypeInterface $entity_type) { + return !$entity_type->isInternal(); + }); + } + + /** + * Tests that all core content/config entity types have HAL test coverage. + */ + public function testEntityTypeHalTestCoverage() { + $tests = [ + // Test coverage for formats provided by the 'hal' module. + 'hal' => [ + 'path' => '\Drupal\Tests\hal\Functional\PROVIDER\CLASS', + 'class suffix' => [ + 'HalJsonAnonTest', + 'HalJsonBasicAuthTest', + 'HalJsonCookieTest', + ], + ], + ]; + + $problems = []; + foreach ($this->definitions as $entity_type_id => $info) { + $class_name_full = $info->getClass(); + $parts = explode('\\', $class_name_full); + $class_name = end($parts); + $module_name = $parts[1]; + + foreach ($tests as $module => $info) { + $path = $info['path']; + $missing_tests = []; + foreach ($info['class suffix'] as $postfix) { + $class = str_replace(['PROVIDER', 'CLASS'], [$module_name, $class_name], $path . $postfix); + if (class_exists($class)) { + continue; + } + $missing_tests[] = $postfix; + } + if (!empty($missing_tests)) { + $missing_tests_list = implode(', ', array_map(function ($missing_test) use ($class_name) { + return $class_name . $missing_test; + }, $missing_tests)); + $which_normalization = $module === 'serialization' ? 'default' : $module; + $problems[] = "$entity_type_id: $class_name ($class_name_full), $which_normalization normalization (expected tests: $missing_tests_list)"; + } + } + + $config_entity = is_subclass_of($class_name_full, ConfigEntityInterface::class); + $config_test = is_subclass_of($class, ConfigEntityResourceTestBase::class); + if ($config_entity && !$config_test) { + $problems[] = "$entity_type_id: $class_name is a config entity, but the test is for content entities."; + } + elseif (!$config_entity && $config_test) { + $problems[] = "$entity_type_id: $class_name is a content entity, but the test is for config entities."; + } + } + $this->assertSame([], $problems); + } + +} diff --git a/core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php b/core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php new file mode 100644 index 000000000000..ac5ff35ea125 --- /dev/null +++ b/core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php @@ -0,0 +1,290 @@ +<?php + +namespace Drupal\Tests\hal\Kernel\rest\Entity; + +use Drupal\KernelTests\KernelTestBase; +use Drupal\rest\Entity\ConfigDependencies; +use Drupal\rest\Entity\RestResourceConfig; +use Drupal\rest\RestResourceConfigInterface; + +/** + * @coversDefaultClass \Drupal\rest\Entity\ConfigDependencies + * + * @group hal + */ +class ConfigDependenciesTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['rest', 'entity_test', 'serialization']; + + /** + * @covers ::calculateDependencies + * + * @dataProvider providerBasicDependencies + */ + public function testCalculateDependencies(array $configuration) { + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create($configuration); + + $result = $config_dependencies->calculateDependencies($rest_config); + $this->assertEquals([ + 'module' => ['basic_auth', 'serialization', 'hal'], + ], $result); + } + + /** + * @covers ::onDependencyRemoval + * @covers ::onDependencyRemovalForMethodGranularity + * @covers ::onDependencyRemovalForResourceGranularity + * + * @dataProvider providerBasicDependencies + */ + public function testOnDependencyRemovalRemoveUnrelatedDependency(array $configuration) { + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create($configuration); + + $this->assertFalse($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['node']])); + $this->assertEquals($configuration['configuration'], $rest_config->get('configuration')); + } + + /** + * @return array + * An array with numerical keys: + * 0. The original REST resource configuration. + */ + public function providerBasicDependencies() { + return [ + 'method' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [ + 'GET' => [ + 'supported_auth' => ['basic_auth'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['hal_json'], + ], + ], + ], + ], + 'resource' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json', 'hal_json'], + 'authentication' => ['cookie', 'basic_auth'], + ], + ], + ], + ]; + } + + /** + * @covers ::onDependencyRemoval + * @covers ::onDependencyRemovalForMethodGranularity + */ + public function testOnDependencyRemovalRemoveFormatForMethodGranularity() { + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create([ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['basic_auth'], + 'supported_formats' => ['hal_json'], + ], + ], + ]); + + $this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['hal']])); + $this->assertEquals(['json'], $rest_config->getFormats('GET')); + $this->assertEquals([], $rest_config->getFormats('POST')); + $this->assertEquals([ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['basic_auth'], + ], + ], $rest_config->get('configuration')); + } + + /** + * @covers ::onDependencyRemoval + * @covers ::onDependencyRemovalForMethodGranularity + */ + public function testOnDependencyRemovalRemoveAuth() { + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create([ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['basic_auth'], + 'supported_formats' => ['hal_json'], + ], + ], + ]); + + $this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['basic_auth']])); + $this->assertEquals(['cookie'], $rest_config->getAuthenticationProviders('GET')); + $this->assertEquals([], $rest_config->getAuthenticationProviders('POST')); + $this->assertEquals([ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_formats' => ['hal_json'], + ], + ], $rest_config->get('configuration')); + } + + /** + * @covers ::onDependencyRemoval + * @covers ::onDependencyRemovalForMethodGranularity + */ + public function testOnDependencyRemovalRemoveAuthAndFormats() { + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create([ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['basic_auth'], + 'supported_formats' => ['hal_json'], + ], + ], + ]); + + $this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['basic_auth', 'hal']])); + $this->assertEquals(['json'], $rest_config->getFormats('GET')); + $this->assertEquals(['cookie'], $rest_config->getAuthenticationProviders('GET')); + $this->assertEquals([], $rest_config->getFormats('POST')); + $this->assertEquals([], $rest_config->getAuthenticationProviders('POST')); + $this->assertEquals([ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + ], $rest_config->get('configuration')); + } + + /** + * @covers ::onDependencyRemoval + * @covers ::onDependencyRemovalForResourceGranularity + * + * @dataProvider providerOnDependencyRemovalForResourceGranularity + */ + public function testOnDependencyRemovalForResourceGranularity(array $configuration, $module, $expected_configuration) { + assert(is_string($module)); + assert($expected_configuration === FALSE || is_array($expected_configuration)); + + $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + + $rest_config = RestResourceConfig::create($configuration); + + $this->assertSame(!empty($expected_configuration), $config_dependencies->onDependencyRemoval($rest_config, ['module' => [$module]])); + if (!empty($expected_configuration)) { + $this->assertEquals($expected_configuration, $rest_config->get('configuration')); + } + } + + /** + * @return array + * An array with numerical keys: + * 0. The original REST resource configuration. + * 1. The module to uninstall (the dependency that is about to be removed). + * 2. The expected configuration after uninstalling this module. + */ + public function providerOnDependencyRemovalForResourceGranularity() { + return [ + 'resource with multiple formats' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json', 'hal_json'], + 'authentication' => ['cookie', 'basic_auth'], + ], + ], + 'hal', + [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json'], + 'authentication' => ['cookie', 'basic_auth'], + ], + ], + 'resource with only HAL+JSON format' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => ['GET', 'POST'], + 'formats' => ['hal_json'], + 'authentication' => ['cookie', 'basic_auth'], + ], + ], + 'hal', + FALSE, + ], + 'resource with multiple authentication providers' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json', 'hal_json'], + 'authentication' => ['cookie', 'basic_auth'], + ], + ], + 'basic_auth', + [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json', 'hal_json'], + 'authentication' => ['cookie'], + ], + ], + 'resource with only basic_auth authentication' => [ + [ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => ['GET', 'POST'], + 'formats' => ['json', 'hal_json'], + 'authentication' => ['basic_auth'], + ], + ], + 'basic_auth', + FALSE, + ], + ]; + } + +} diff --git a/core/modules/hal/tests/src/Kernel/rest/Entity/RestResourceConfigTest.php b/core/modules/hal/tests/src/Kernel/rest/Entity/RestResourceConfigTest.php new file mode 100644 index 000000000000..16f0d09cef63 --- /dev/null +++ b/core/modules/hal/tests/src/Kernel/rest/Entity/RestResourceConfigTest.php @@ -0,0 +1,51 @@ +<?php + +namespace Drupal\Tests\hal\Kernel\rest\Entity; + +use Drupal\KernelTests\KernelTestBase; +use Drupal\rest\Entity\RestResourceConfig; +use Drupal\rest\RestResourceConfigInterface; + +/** + * @coversDefaultClass \Drupal\rest\Entity\RestResourceConfig + * + * @group hal + */ +class RestResourceConfigTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'rest', + 'entity_test', + 'serialization', + 'basic_auth', + 'user', + 'hal', + ]; + + /** + * @covers ::calculateDependencies + */ + public function testCalculateDependencies() { + $rest_config = RestResourceConfig::create([ + 'plugin_id' => 'entity:entity_test', + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [ + 'GET' => [ + 'supported_auth' => ['cookie'], + 'supported_formats' => ['json'], + ], + 'POST' => [ + 'supported_auth' => ['basic_auth'], + 'supported_formats' => ['hal_json'], + ], + ], + ]); + + $rest_config->calculateDependencies(); + $this->assertEquals(['module' => ['basic_auth', 'entity_test', 'hal', 'serialization', 'user']], $rest_config->getDependencies()); + } + +} diff --git a/core/modules/hal/tests/src/Kernel/rest/Views/StyleSerializerKernelTest.php b/core/modules/hal/tests/src/Kernel/rest/Views/StyleSerializerKernelTest.php new file mode 100644 index 000000000000..8211b9d1200e --- /dev/null +++ b/core/modules/hal/tests/src/Kernel/rest/Views/StyleSerializerKernelTest.php @@ -0,0 +1,50 @@ +<?php + +namespace Drupal\Tests\hal\Kernel\rest\Views; + +use Drupal\Tests\views\Kernel\ViewsKernelTestBase; +use Drupal\views\Entity\View; +use Drupal\views\Tests\ViewTestData; + +/** + * @coversDefaultClass \Drupal\rest\Plugin\views\style\Serializer + * @group hal + */ +class StyleSerializerKernelTest extends ViewsKernelTestBase { + + /** + * {@inheritdoc} + */ + public static $testViews = ['test_serializer_display_entity']; + + /** + * {@inheritdoc} + */ + protected static $modules = ['hal', 'hal_test_views', 'serialization', 'rest']; + + /** + * {@inheritdoc} + */ + protected function setUp($import_test_views = TRUE): void { + parent::setUp($import_test_views); + + ViewTestData::createTestViews(static::class, ['hal_test_views']); + } + + /** + * @covers ::calculateDependencies + */ + public function testCalculateDepenencies() { + /** @var \Drupal\views\Entity\View $view */ + $view = View::load('test_serializer_display_entity'); + $display = &$view->getDisplay('rest_export_1'); + $display['display_options']['defaults']['style'] = FALSE; + $display['display_options']['style']['type'] = 'serializer'; + $display['display_options']['style']['options']['formats'] = ['json', 'xml', 'hal_json']; + $view->save(); + + $view->calculateDependencies(); + $this->assertEquals(['module' => ['hal', 'rest', 'serialization', 'user']], $view->getDependencies()); + } + +} diff --git a/core/modules/hal/tests/src/Kernel/serialization/FieldItemSerializationTest.php b/core/modules/hal/tests/src/Kernel/serialization/FieldItemSerializationTest.php new file mode 100644 index 000000000000..b8bb09ba1000 --- /dev/null +++ b/core/modules/hal/tests/src/Kernel/serialization/FieldItemSerializationTest.php @@ -0,0 +1,194 @@ +<?php + +namespace Drupal\Tests\hal\Kernel\serialization; + +use Drupal\entity_test\Entity\EntityTestMulRev; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; +use Drupal\Tests\serialization\Kernel\NormalizerTestBase; + +/** + * Test field level normalization process. + * + * @group hal + */ +class FieldItemSerializationTest extends NormalizerTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'serialization', + 'system', + 'field', + 'entity_test', + 'text', + 'filter', + 'user', + 'field_normalization_test', + ]; + + /** + * The class name of the test class. + * + * @var string + */ + protected $entityClass = 'Drupal\entity_test\Entity\EntityTestMulRev'; + + /** + * The test values. + * + * @var array + */ + protected $values; + + /** + * The test entity. + * + * @var \Drupal\Core\Entity\ContentEntityBase + */ + protected $entity; + + /** + * The serializer service. + * + * @var \Symfony\Component\Serializer\Serializer + */ + protected $serializer; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + // Auto-create a field for testing default field values. + FieldStorageConfig::create([ + 'entity_type' => 'entity_test_mulrev', + 'field_name' => 'field_test_text_default', + 'type' => 'text', + 'cardinality' => 1, + 'translatable' => FALSE, + ])->save(); + FieldConfig::create([ + 'entity_type' => 'entity_test_mulrev', + 'field_name' => 'field_test_text_default', + 'bundle' => 'entity_test_mulrev', + 'label' => 'Test text-field with default', + 'default_value' => [ + [ + 'value' => 'This is the default', + 'format' => 'full_html', + ], + ], + 'widget' => [ + 'type' => 'text_textfield', + 'weight' => 0, + ], + ])->save(); + FieldStorageConfig::create([ + 'entity_type' => 'entity_test_mulrev', + 'field_name' => 'field_test_boolean', + 'type' => 'boolean', + 'cardinality' => 1, + 'translatable' => FALSE, + ])->save(); + FieldConfig::create([ + 'entity_type' => 'entity_test_mulrev', + 'field_name' => 'field_test_boolean', + 'bundle' => 'entity_test_mulrev', + 'label' => 'Test boolean', + ])->save(); + + // Create a test entity to serialize. + $this->values = [ + 'name' => $this->randomMachineName(), + 'field_test_text' => [ + 'value' => $this->randomMachineName(), + 'format' => 'full_html', + ], + 'field_test_boolean' => [ + 'value' => FALSE, + ], + ]; + $this->entity = EntityTestMulRev::create($this->values); + $this->entity->save(); + + $this->serializer = $this->container->get('serializer'); + + $this->installConfig(['field']); + } + + /** + * Tests a format-agnostic normalizer. + * + * @param string[] $test_modules + * The test modules to install. + * @param string $format + * The format to test. (NULL results in the format-agnostic normalization.) + * + * @dataProvider providerTestCustomBooleanNormalization + */ + public function testCustomBooleanNormalization(array $test_modules, $format) { + // Asserts the entity contains the value we set. + $this->assertFalse($this->entity->field_test_boolean->value); + + // Asserts normalizing the entity using core's 'serializer' service DOES + // yield the value we set. + $core_normalization = $this->container->get('serializer')->normalize($this->entity, $format); + $this->assertFalse($core_normalization['field_test_boolean'][0]['value']); + + $assert_denormalization = function (array $normalization) use ($format) { + $denormalized_entity = $this->container->get('serializer')->denormalize($normalization, EntityTestMulRev::class, $format, []); + $this->assertInstanceOf(EntityTestMulRev::class, $denormalized_entity); + $this->assertTrue($denormalized_entity->field_test_boolean->value); + }; + + // Asserts denormalizing the entity DOES yield the value we set: + // - when using the detailed representation + $core_normalization['field_test_boolean'][0]['value'] = TRUE; + $assert_denormalization($core_normalization); + // - and when using the shorthand representation + $core_normalization['field_test_boolean'][0] = TRUE; + $assert_denormalization($core_normalization); + + // Install test module that contains a high-priority alternative normalizer. + $this->enableModules($test_modules); + + // Asserts normalizing the entity DOES NOT ANYMORE yield the value we set. + $core_normalization = $this->container->get('serializer')->normalize($this->entity, $format); + $this->assertSame('👎', $core_normalization['field_test_boolean'][0]['value']); + + // Asserts denormalizing the entity DOES NOT ANYMORE yield the value we set: + // - when using the detailed representation + $core_normalization['field_test_boolean'][0]['value'] = 'ðŸ‘'; + $assert_denormalization($core_normalization); + // - and when using the shorthand representation + $core_normalization['field_test_boolean'][0] = 'ðŸ‘'; + $assert_denormalization($core_normalization); + } + + /** + * Data provider. + * + * @return array + * Test cases. + */ + public function providerTestCustomBooleanNormalization() { + return [ + 'Format-agnostic @FieldType-level normalizers SHOULD be able to affect the HAL+JSON normalization' => [ + ['test_fieldtype_boolean_emoji_normalizer'], + 'hal_json', + ], + 'Format-agnostic @DataType-level normalizers SHOULD be able to affect the HAL+JSON normalization' => [ + ['test_datatype_boolean_emoji_normalizer', 'hal'], + 'hal_json', + ], + 'Format-agnostic @DataType-level normalizers SHOULD be able to affect the XML normalization' => [ + ['test_datatype_boolean_emoji_normalizer', 'hal'], + 'xml', + ], + ]; + } + +} diff --git a/core/modules/help_topics/help_topics/core.web_services.html.twig b/core/modules/help_topics/help_topics/core.web_services.html.twig index a052e445a90a..a0f4e87f743d 100644 --- a/core/modules/help_topics/help_topics/core.web_services.html.twig +++ b/core/modules/help_topics/help_topics/core.web_services.html.twig @@ -22,7 +22,7 @@ related: <dd>{% trans %}Exposes entities and other resources to other applications using a <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">REST</a> implementation. Data is exchanged using a serialization format such as HAL, and transferred using an authentication method such as HTTP Basic Authentication.{% endtrans %}</dd> <dt>{% trans %}Serialization module{% endtrans %}</dt> <dd>{% trans %}Provides a framework for adding specific serialization formats for other modules to use.{% endtrans %}</dd> - <dt>{% trans %}HAL module{% endtrans %}</dt> + <dt>{% trans %}HAL module or its contributed replacement.{% endtrans %}</dt> <dd>{% trans %}Adds support for serializing content entities using the JSON version of HAL.{% endtrans %}</dd> <dt>{% trans %}HTTP Basic Authentication module{% endtrans %}</dt> <dd>{% trans %}Provides a way for web services to be authenticated using HTTP Basic authentication against Drupal user accounts.{% endtrans %}</dd> diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php index d96ff7601229..cad23273daf5 100644 --- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php +++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php @@ -147,46 +147,6 @@ public function testQueryParameterFormatRequests() { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); // Verify that the correct JSON response was returned. $this->assertSession()->responseContains('{"content":"oh hai this is json"}'); - - // Enable REST support for nodes and hal+json. - \Drupal::service('module_installer')->install(['node', 'rest', 'hal', 'basic_auth']); - $this->drupalCreateContentType(['type' => 'article']); - $node = $this->drupalCreateNode(['type' => 'article']); - $node_uri = $node->toUrl(); - $node_url_with_hal_json_format = $node->toUrl('canonical')->setRouteParameter('_format', 'hal_json'); - - $this->drupalGet($node_uri); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); - $this->drupalGet($node_uri); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); - - // Now request a HAL page, we expect that the first request is a cache miss - // and it serves HTML. - $this->drupalGet($node_url_with_hal_json_format); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); - $this->drupalGet($node_url_with_hal_json_format); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); - - // Clear the page cache. After that request a HAL request, followed by an - // ordinary HTML one. - \Drupal::cache('page')->deleteAll(); - $this->drupalGet($node_url_with_hal_json_format); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); - $this->drupalGet($node_url_with_hal_json_format); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); - - $this->drupalGet($node_uri); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'MISS'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); - $this->drupalGet($node_uri); - $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); } /** diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index bfdf97fb45cd..8b9add719aec 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -41,11 +41,6 @@ * - \Drupal\Tests\rest\Functional\EntityResource\Node\NodeJsonAnonTest * - \Drupal\Tests\rest\Functional\EntityResource\Node\NodeJsonBasicAuthTest * - \Drupal\Tests\rest\Functional\EntityResource\Node\NodeJsonCookieTest - * But the HAL module also adds a new format ('hal_json'), so that format also - * needs test coverage (for its own peculiarities in normalization & encoding): - * - \Drupal\Tests\hal\Functional\EntityResource\Node\NodeHalJsonAnonTest - * - \Drupal\Tests\hal\Functional\EntityResource\Node\NodeHalJsonBasicAuthTest - * - \Drupal\Tests\hal\Functional\EntityResource\Node\NodeHalJsonCookieTest * * In other words: for every entity type there should be: * 1. an abstract subclass that includes the entity type-specific authorization diff --git a/core/modules/rest/tests/src/Functional/ResourceTest.php b/core/modules/rest/tests/src/Functional/ResourceTest.php index 1ed9aebc00e1..1ebe619d4d78 100644 --- a/core/modules/rest/tests/src/Functional/ResourceTest.php +++ b/core/modules/rest/tests/src/Functional/ResourceTest.php @@ -23,7 +23,7 @@ class ResourceTest extends BrowserTestBase { * * @var array */ - protected static $modules = ['hal', 'rest', 'entity_test', 'rest_test']; + protected static $modules = ['rest', 'entity_test', 'rest_test']; /** * {@inheritdoc} @@ -77,7 +77,7 @@ public function testFormats() { ])->save(); // Verify that accessing the resource returns 406. - $this->drupalGet($this->entity->toUrl()->setRouteParameter('_format', 'hal_json')); + $this->drupalGet($this->entity->toUrl()->setRouteParameter('_format', 'json')); // \Drupal\Core\Routing\RequestFormatRouteFilter considers the canonical, // non-REST route a match, but a lower quality one: no format restrictions // means there's always a match and hence when there is no matching REST @@ -96,14 +96,14 @@ public function testAuthentication() { 'configuration' => [ 'GET' => [ 'supported_formats' => [ - 'hal_json', + 'json', ], ], ], ])->save(); // Verify that accessing the resource returns 401. - $this->drupalGet($this->entity->toUrl()->setRouteParameter('_format', 'hal_json')); + $this->drupalGet($this->entity->toUrl()->setRouteParameter('_format', 'json')); // \Drupal\Core\Routing\RequestFormatRouteFilter considers the canonical, // non-REST route a match, but a lower quality one: no format restrictions // means there's always a match and hence when there is no matching REST diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index bcbf57e6da0c..0a6cad991c0e 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -39,7 +39,6 @@ class StyleSerializerTest extends ViewTestBase { protected static $modules = [ 'views_ui', 'entity_test', - 'hal', 'rest_test_views', 'node', 'text', @@ -194,11 +193,6 @@ public function testSerializerResponses() { $this->assertCacheTags($expected_cache_tags); $this->assertCacheContexts(['languages:language_interface', 'theme', 'entity_test_view_grants', 'request_format']); - $expected = $serializer->serialize($entities, 'hal_json'); - $actual_json = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'hal_json']]); - $this->assertSame($expected, $actual_json, 'The expected HAL output was found.'); - $this->assertCacheTags($expected_cache_tags); - // Change the format to xml. $view->setDisplay('rest_export_1'); $view->getDisplay()->setOption('style', [ @@ -876,7 +870,7 @@ public function testMulEntityRows() { // Get the names of the output. $json = $this->drupalGet('test/serialize/translated_entity', ['query' => ['_format' => 'json']]); - $decoded = $this->container->get('serializer')->decode($json, 'hal_json'); + $decoded = $this->container->get('serializer')->decode($json, 'json'); $names = []; foreach ($decoded as $item) { $names[] = $item['name'][0]['value']; diff --git a/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php b/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php index ca0bac7221a2..e854cb71cc0b 100644 --- a/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php +++ b/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php @@ -25,13 +25,13 @@ class ConfigDependenciesTest extends KernelTestBase { * @dataProvider providerBasicDependencies */ public function testCalculateDependencies(array $configuration) { - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + $config_dependencies = new ConfigDependencies(['json' => 'serialization'], ['basic_auth' => 'basic_auth']); $rest_config = RestResourceConfig::create($configuration); $result = $config_dependencies->calculateDependencies($rest_config); $this->assertEquals([ - 'module' => ['basic_auth', 'serialization', 'hal'], + 'module' => ['basic_auth', 'serialization'], ], $result); } @@ -43,7 +43,7 @@ public function testCalculateDependencies(array $configuration) { * @dataProvider providerBasicDependencies */ public function testOnDependencyRemovalRemoveUnrelatedDependency(array $configuration) { - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + $config_dependencies = new ConfigDependencies(['json' => 'serialization'], ['basic_auth' => 'basic_auth']); $rest_config = RestResourceConfig::create($configuration); @@ -69,7 +69,7 @@ public function providerBasicDependencies() { ], 'POST' => [ 'supported_auth' => ['cookie'], - 'supported_formats' => ['hal_json'], + 'supported_formats' => ['xml'], ], ], ], @@ -80,7 +80,7 @@ public function providerBasicDependencies() { 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, 'configuration' => [ 'methods' => ['GET', 'POST'], - 'formats' => ['json', 'hal_json'], + 'formats' => ['json'], 'authentication' => ['cookie', 'basic_auth'], ], ], @@ -88,48 +88,12 @@ public function providerBasicDependencies() { ]; } - /** - * @covers ::onDependencyRemoval - * @covers ::onDependencyRemovalForMethodGranularity - */ - public function testOnDependencyRemovalRemoveFormatForMethodGranularity() { - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); - - $rest_config = RestResourceConfig::create([ - 'plugin_id' => 'entity:entity_test', - 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, - 'configuration' => [ - 'GET' => [ - 'supported_auth' => ['cookie'], - 'supported_formats' => ['json'], - ], - 'POST' => [ - 'supported_auth' => ['basic_auth'], - 'supported_formats' => ['hal_json'], - ], - ], - ]); - - $this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['hal']])); - $this->assertEquals(['json'], $rest_config->getFormats('GET')); - $this->assertEquals([], $rest_config->getFormats('POST')); - $this->assertEquals([ - 'GET' => [ - 'supported_auth' => ['cookie'], - 'supported_formats' => ['json'], - ], - 'POST' => [ - 'supported_auth' => ['basic_auth'], - ], - ], $rest_config->get('configuration')); - } - /** * @covers ::onDependencyRemoval * @covers ::onDependencyRemovalForMethodGranularity */ public function testOnDependencyRemovalRemoveAuth() { - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + $config_dependencies = new ConfigDependencies(['json' => 'serialization'], ['basic_auth' => 'basic_auth']); $rest_config = RestResourceConfig::create([ 'plugin_id' => 'entity:entity_test', @@ -141,7 +105,7 @@ public function testOnDependencyRemovalRemoveAuth() { ], 'POST' => [ 'supported_auth' => ['basic_auth'], - 'supported_formats' => ['hal_json'], + 'supported_formats' => ['json'], ], ], ]); @@ -155,41 +119,6 @@ public function testOnDependencyRemovalRemoveAuth() { 'supported_formats' => ['json'], ], 'POST' => [ - 'supported_formats' => ['hal_json'], - ], - ], $rest_config->get('configuration')); - } - - /** - * @covers ::onDependencyRemoval - * @covers ::onDependencyRemovalForMethodGranularity - */ - public function testOnDependencyRemovalRemoveAuthAndFormats() { - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); - - $rest_config = RestResourceConfig::create([ - 'plugin_id' => 'entity:entity_test', - 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, - 'configuration' => [ - 'GET' => [ - 'supported_auth' => ['cookie'], - 'supported_formats' => ['json'], - ], - 'POST' => [ - 'supported_auth' => ['basic_auth'], - 'supported_formats' => ['hal_json'], - ], - ], - ]); - - $this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, ['module' => ['basic_auth', 'hal']])); - $this->assertEquals(['json'], $rest_config->getFormats('GET')); - $this->assertEquals(['cookie'], $rest_config->getAuthenticationProviders('GET')); - $this->assertEquals([], $rest_config->getFormats('POST')); - $this->assertEquals([], $rest_config->getAuthenticationProviders('POST')); - $this->assertEquals([ - 'GET' => [ - 'supported_auth' => ['cookie'], 'supported_formats' => ['json'], ], ], $rest_config->get('configuration')); @@ -205,7 +134,7 @@ public function testOnDependencyRemovalForResourceGranularity(array $configurati assert(is_string($module)); assert($expected_configuration === FALSE || is_array($expected_configuration)); - $config_dependencies = new ConfigDependencies(['hal_json' => 'hal', 'json' => 'serialization'], ['basic_auth' => 'basic_auth']); + $config_dependencies = new ConfigDependencies(['json' => 'serialization'], ['basic_auth' => 'basic_auth']); $rest_config = RestResourceConfig::create($configuration); @@ -230,44 +159,31 @@ public function providerOnDependencyRemovalForResourceGranularity() { 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, 'configuration' => [ 'methods' => ['GET', 'POST'], - 'formats' => ['json', 'hal_json'], + 'formats' => ['xml', 'json'], 'authentication' => ['cookie', 'basic_auth'], ], ], - 'hal', + 'serialization', [ 'methods' => ['GET', 'POST'], - 'formats' => ['json'], + 'formats' => ['xml'], 'authentication' => ['cookie', 'basic_auth'], ], ], - 'resource with only HAL+JSON format' => [ - [ - 'plugin_id' => 'entity:entity_test', - 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, - 'configuration' => [ - 'methods' => ['GET', 'POST'], - 'formats' => ['hal_json'], - 'authentication' => ['cookie', 'basic_auth'], - ], - ], - 'hal', - FALSE, - ], 'resource with multiple authentication providers' => [ [ 'plugin_id' => 'entity:entity_test', 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, 'configuration' => [ 'methods' => ['GET', 'POST'], - 'formats' => ['json', 'hal_json'], + 'formats' => ['json', 'xml'], 'authentication' => ['cookie', 'basic_auth'], ], ], 'basic_auth', [ 'methods' => ['GET', 'POST'], - 'formats' => ['json', 'hal_json'], + 'formats' => ['json', 'xml'], 'authentication' => ['cookie'], ], ], @@ -277,7 +193,7 @@ public function providerOnDependencyRemovalForResourceGranularity() { 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, 'configuration' => [ 'methods' => ['GET', 'POST'], - 'formats' => ['json', 'hal_json'], + 'formats' => ['json', 'xml'], 'authentication' => ['basic_auth'], ], ], diff --git a/core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php b/core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php index f7de6943ff06..7fa5de9df74c 100644 --- a/core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php +++ b/core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php @@ -22,7 +22,6 @@ class RestPermissionsTest extends KernelTestBase { 'serialization', 'basic_auth', 'user', - 'hal', ]; /** diff --git a/core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php b/core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php index e5cdb1f2f914..e089a85fe737 100644 --- a/core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php +++ b/core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php @@ -22,7 +22,6 @@ class RestResourceConfigTest extends KernelTestBase { 'serialization', 'basic_auth', 'user', - 'hal', ]; /** @@ -39,13 +38,13 @@ public function testCalculateDependencies() { ], 'POST' => [ 'supported_auth' => ['basic_auth'], - 'supported_formats' => ['hal_json'], + 'supported_formats' => ['json'], ], ], ]); $rest_config->calculateDependencies(); - $this->assertEquals(['module' => ['basic_auth', 'entity_test', 'hal', 'serialization', 'user']], $rest_config->getDependencies()); + $this->assertEquals(['module' => ['basic_auth', 'entity_test', 'serialization', 'user']], $rest_config->getDependencies()); } } diff --git a/core/modules/rest/tests/src/Kernel/EntityResource/EntityResourceRestTestCoverageTest.php b/core/modules/rest/tests/src/Kernel/EntityResource/EntityResourceRestTestCoverageTest.php index cba5404977c6..5e8a5ad336a9 100644 --- a/core/modules/rest/tests/src/Kernel/EntityResource/EntityResourceRestTestCoverageTest.php +++ b/core/modules/rest/tests/src/Kernel/EntityResource/EntityResourceRestTestCoverageTest.php @@ -12,7 +12,7 @@ * Checks that all core content/config entity types have REST test coverage. * * Every entity type must have test coverage for: - * - every format in core (json + xml + hal_json) + * - every format in core (json + xml) * - every authentication provider in core (anon, cookie, basic_auth) * * Additionally, every entity type must have the correct parent test class. @@ -79,15 +79,6 @@ public function testEntityTypeRestTestCoverage() { 'XmlCookieTest', ], ], - // Test coverage for formats provided by the 'hal' module. - 'hal' => [ - 'path' => '\Drupal\Tests\PROVIDER\Functional\Hal\CLASS', - 'class suffix' => [ - 'HalJsonAnonTest', - 'HalJsonBasicAuthTest', - 'HalJsonCookieTest', - ], - ], ]; $problems = []; diff --git a/core/modules/rest/tests/src/Kernel/Views/StyleSerializerKernelTest.php b/core/modules/rest/tests/src/Kernel/Views/StyleSerializerKernelTest.php index 440cd6a0f198..7baa66ed6632 100644 --- a/core/modules/rest/tests/src/Kernel/Views/StyleSerializerKernelTest.php +++ b/core/modules/rest/tests/src/Kernel/Views/StyleSerializerKernelTest.php @@ -46,16 +46,6 @@ public function testCalculateDepenencies() { $view->calculateDependencies(); $this->assertEquals(['module' => ['rest', 'serialization', 'user']], $view->getDependencies()); - - \Drupal::service('module_installer')->install(['hal']); - - $view = View::load('test_serializer_display_entity'); - $display = &$view->getDisplay('rest_export_1'); - $display['display_options']['style']['options']['formats'] = ['json', 'xml', 'hal_json']; - $view->save(); - - $view->calculateDependencies(); - $this->assertEquals(['module' => ['hal', 'rest', 'serialization', 'user']], $view->getDependencies()); } } diff --git a/core/modules/serialization/tests/src/Kernel/FieldItemSerializationTest.php b/core/modules/serialization/tests/src/Kernel/FieldItemSerializationTest.php index f6123c8218c0..0eb95961e053 100644 --- a/core/modules/serialization/tests/src/Kernel/FieldItemSerializationTest.php +++ b/core/modules/serialization/tests/src/Kernel/FieldItemSerializationTest.php @@ -231,22 +231,10 @@ public function providerTestCustomBooleanNormalization() { ['test_datatype_boolean_emoji_normalizer'], 'json', ], - 'Format-agnostic @FieldType-level normalizers SHOULD be able to affect the HAL+JSON normalization' => [ - ['test_fieldtype_boolean_emoji_normalizer'], - 'hal_json', - ], - 'Format-agnostic @DataType-level normalizers SHOULD be able to affect the HAL+JSON normalization' => [ - ['test_datatype_boolean_emoji_normalizer', 'hal'], - 'hal_json', - ], 'Format-agnostic @FieldType-level normalizers SHOULD be able to affect the XML normalization' => [ ['test_fieldtype_boolean_emoji_normalizer'], 'xml', ], - 'Format-agnostic @DataType-level normalizers SHOULD be able to affect the XML normalization' => [ - ['test_datatype_boolean_emoji_normalizer', 'hal'], - 'xml', - ], ]; } diff --git a/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php b/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php index e3b880282f98..ab7185e80f5c 100644 --- a/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php +++ b/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php @@ -36,12 +36,6 @@ public function testEncoders() { $encoder_2_definition->setPublic(TRUE); $container->setDefinition('encoder_2', $encoder_2_definition); - $encoder_3_definition = new Definition('TestClass'); - $encoder_3_definition->addTag('encoder', ['format' => 'hal_json']); - $encoder_3_definition->addTag('_provider', ['provider' => 'test_provider_b']); - $encoder_3_definition->setPublic(TRUE); - $container->setDefinition('encoder_3', $encoder_3_definition); - $normalizer_1_definition = new Definition('TestClass'); $normalizer_1_definition->addTag('normalizer'); $normalizer_1_definition->setPublic(TRUE); @@ -51,13 +45,12 @@ public function testEncoders() { $compiler_pass->process($container); // Check registration of formats and providers. - $this->assertEquals(['xml', 'json', 'hal_json'], $container->getParameter('serializer.formats')); - $this->assertEquals(['xml' => 'test_provider_a', 'json' => 'test_provider_a', 'hal_json' => 'test_provider_b'], $container->getParameter('serializer.format_providers')); + $this->assertEquals(['xml', 'json'], $container->getParameter('serializer.formats')); + $this->assertEquals(['xml' => 'test_provider_a', 'json' => 'test_provider_a'], $container->getParameter('serializer.format_providers')); // Check all encoder and normalizer service definitions are marked private. $this->assertFalse($encoder_1_definition->isPublic()); $this->assertFalse($encoder_2_definition->isPublic()); - $this->assertFalse($encoder_3_definition->isPublic()); $this->assertFalse($normalizer_1_definition->isPublic()); } diff --git a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php index 45f2bb7c5813..0f60fbe72e82 100644 --- a/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php +++ b/core/modules/system/tests/modules/accept_header_routing_test/src/AcceptHeaderMiddleware.php @@ -27,7 +27,6 @@ public function __construct(HttpKernelInterface $app) { public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE): Response { $mapping = [ 'application/json' => 'json', - 'application/hal+json' => 'hal_json', 'application/xml' => 'xml', 'text/html' => 'html', ]; diff --git a/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php b/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php index 38d842dddf30..a86f82342261 100644 --- a/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php +++ b/core/modules/system/tests/src/Functional/System/ResponseGeneratorTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\system\Functional\System; use Drupal\rest\Entity\RestResourceConfig; +use Drupal\rest\RestResourceConfigInterface; use Drupal\Tests\BrowserTestBase; /** @@ -17,7 +18,7 @@ class ResponseGeneratorTest extends BrowserTestBase { * * @var array */ - protected static $modules = ['hal', 'rest', 'node', 'basic_auth']; + protected static $modules = ['serialization', 'rest', 'node', 'basic_auth']; /** * {@inheritdoc} @@ -45,30 +46,47 @@ public function testGeneratorHeaderAdded() { [$version] = explode('.', \Drupal::VERSION, 2); $expectedGeneratorHeader = 'Drupal ' . $version . ' (https://www.drupal.org)'; - // Check to see if the header is added when viewing a normal content page + // Check to see if the header is added when viewing an HTML page. $this->drupalGet($node->toUrl()); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); $this->assertSession()->responseHeaderEquals('X-Generator', $expectedGeneratorHeader); - // Check to see if the header is also added for a non-successful response + // Check to see if the header is also added for a non-successful response. $this->drupalGet('llama'); $this->assertSession()->statusCodeEquals(404); $this->assertSession()->responseHeaderEquals('Content-Type', 'text/html; charset=UTF-8'); $this->assertSession()->responseHeaderEquals('X-Generator', $expectedGeneratorHeader); - // Enable cookie-based authentication for the entity:node REST resource. - /** @var \Drupal\rest\RestResourceConfigInterface $resource_config */ - $resource_config = RestResourceConfig::load('entity.node'); - $configuration = $resource_config->get('configuration'); - $configuration['authentication'][] = 'cookie'; - $resource_config->set('configuration', $configuration)->save(); + // Create a cookie-based authentication for the entity:node REST resource. + // @todo Turn this back in to an optional config YAML file in D10 to have an + // example config for REST endpoints and adjust + // core/modules/help_topics/help_topics/core.web_services.html.twig and + // core/core.api.php accordingly. + // See https://www.drupal.org/project/drupal/issues/3049857 + $resource_config_values = [ + 'id' => 'entity.node', + 'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY, + 'configuration' => [ + 'methods' => [ + 'GET', + ], + 'formats' => [ + 'json', + ], + 'authentication' => [ + 'cookie', + ], + ], + ]; + + RestResourceConfig::create($resource_config_values)->save(); $this->rebuildAll(); - // Tests to see if this also works for a non-html request - $this->drupalGet($node->toUrl()->setOption('query', ['_format' => 'hal_json'])); + // Check to see if the header is also added for a non-HTML request. + $this->drupalGet($node->toUrl()->setOption('query', ['_format' => 'json'])); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->responseHeaderEquals('Content-Type', 'application/hal+json'); + $this->assertSession()->responseHeaderEquals('Content-Type', 'application/json'); $this->assertSession()->responseHeaderEquals('X-Generator', $expectedGeneratorHeader); } diff --git a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php index 7751707a1398..b2f87f28d131 100644 --- a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php @@ -11,7 +11,6 @@ use Psr\Http\Message\ResponseInterface; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Encoder\XmlEncoder; -use Drupal\hal\Encoder\JsonEncoder as HALJsonEncoder; use Symfony\Component\Serializer\Serializer; /** @@ -30,7 +29,7 @@ class UserLoginHttpTest extends BrowserTestBase { * * @var array */ - protected static $modules = ['hal', 'dblog']; + protected static $modules = ['dblog']; /** * {@inheritdoc} @@ -57,12 +56,12 @@ class UserLoginHttpTest extends BrowserTestBase { protected function setUp(): void { parent::setUp(); $this->cookies = new CookieJar(); - $encoders = [new JsonEncoder(), new XmlEncoder(), new HALJsonEncoder()]; + $encoders = [new JsonEncoder(), new XmlEncoder()]; $this->serializer = new Serializer([], $encoders); } /** - * Executes a login HTTP request. + * Executes a login HTTP request for a given serialization format. * * @param string $name * The username. @@ -109,7 +108,6 @@ public function testLogin() { $this->container->get('module_installer')->install(['serialization']); $this->doTestLogin('json'); $this->doTestLogin('xml'); - $this->doTestLogin('hal_json'); } /** @@ -206,7 +204,7 @@ protected function doTestLogin($format) { } /** - * Executes a password HTTP request. + * Executes a password HTTP request for a given serialization format. * * @param array $request_body * The request body. @@ -248,7 +246,10 @@ public function testPasswordReset() { $this->doTestPasswordReset('json', $account); $this->doTestPasswordReset('xml', $account); - $this->doTestPasswordReset('hal_json', $account); + + $this->doTestGlobalLoginFloodControl('json'); + $this->doTestPerUserLoginFloodControl('json'); + $this->doTestLogoutCsrfProtection('json'); } /** @@ -282,12 +283,15 @@ protected function resetFlood() { } /** - * Tests the global login flood control. + * Tests the global login flood control for a given serialization format. + * + * @param string $format + * The encoded format. * - * @see \Drupal\basic_auth\Tests\Authentication\BasicAuthTest::testGlobalLoginFloodControl - * @see \Drupal\user\Tests\UserLoginTest::testGlobalLoginFloodControl + * @see \Drupal\basic_auth\Authentication\Provider\BasicAuthTest::testGlobalLoginFloodControl + * @see \Drupal\Tests\user\Functional\UserLoginTest::testGlobalLoginFloodControl */ - public function testGlobalLoginFloodControl() { + public function doTestGlobalLoginFloodControl(string $format): void { $database = \Drupal::database(); $this->config('user.flood') ->set('ip_limit', 2) @@ -301,13 +305,13 @@ public function testGlobalLoginFloodControl() { // Try 2 failed logins. for ($i = 0; $i < 2; $i++) { - $response = $this->loginRequest($incorrect_user->getAccountName(), $incorrect_user->passRaw); + $response = $this->loginRequest($incorrect_user->getAccountName(), $incorrect_user->passRaw, $format); $this->assertEquals('400', $response->getStatusCode()); } // IP limit has reached to its limit. Even valid user credentials will fail. - $response = $this->loginRequest($user->getAccountName(), $user->passRaw); - $this->assertHttpResponseWithMessage($response, '403', 'Access is blocked because of IP based flood prevention.'); + $response = $this->loginRequest($user->getAccountName(), $user->passRaw, $format); + $this->assertHttpResponseWithMessage($response, '403', 'Access is blocked because of IP based flood prevention.', $format); $last_log = $database->select('watchdog', 'w') ->fields('w', ['message']) ->condition('type', 'user') @@ -355,12 +359,12 @@ protected function assertHttpResponseWithMessage(ResponseInterface $response, in } /** - * Tests the per-user login flood control. + * Tests the per-user login flood control for a given serialization format. * - * @see \Drupal\user\Tests\UserLoginTest::testPerUserLoginFloodControl - * @see \Drupal\basic_auth\Tests\Authentication\BasicAuthTest::testPerUserLoginFloodControl + * @see \Drupal\basic_auth\Authentication\Provider\BasicAuthTest::testPerUserLoginFloodControl + * @see \Drupal\Tests\user\Functional\UserLoginTest::testPerUserLoginFloodControl */ - public function testPerUserLoginFloodControl() { + public function doTestPerUserLoginFloodControl($format): void { $database = \Drupal::database(); foreach ([TRUE, FALSE] as $uid_only_setting) { $this->config('user.flood') @@ -378,19 +382,19 @@ public function testPerUserLoginFloodControl() { // Try 2 failed logins. for ($i = 0; $i < 2; $i++) { - $response = $this->loginRequest($incorrect_user1->getAccountName(), $incorrect_user1->passRaw); - $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.'); + $response = $this->loginRequest($incorrect_user1->getAccountName(), $incorrect_user1->passRaw, $format); + $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); } // A successful login will reset the per-user flood control count. - $response = $this->loginRequest($user1->getAccountName(), $user1->passRaw); - $result_data = $this->serializer->decode($response->getBody(), 'json'); - $this->logoutRequest('json', $result_data['logout_token']); + $response = $this->loginRequest($user1->getAccountName(), $user1->passRaw, $format); + $result_data = $this->serializer->decode($response->getBody(), $format); + $this->logoutRequest($format, $result_data['logout_token']); // Try 3 failed logins for user 1, they will not trigger flood control. for ($i = 0; $i < 3; $i++) { - $response = $this->loginRequest($incorrect_user1->getAccountName(), $incorrect_user1->passRaw); - $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.'); + $response = $this->loginRequest($incorrect_user1->getAccountName(), $incorrect_user1->passRaw, $format); + $this->assertHttpResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); } // Try one successful attempt for user 2, it should not trigger any @@ -400,7 +404,7 @@ public function testPerUserLoginFloodControl() { // Try one more attempt for user 1, it should be rejected, even if the // correct password has been used. - $response = $this->loginRequest($user1->getAccountName(), $user1->passRaw); + $response = $this->loginRequest($user1->getAccountName(), $user1->passRaw, $format); // Depending on the uid_only setting the error message will be different. if ($uid_only_setting) { $expected_message = 'There have been more than 3 failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.'; @@ -410,7 +414,7 @@ public function testPerUserLoginFloodControl() { $expected_message = 'Too many failed login attempts from your IP address. This IP address is temporarily blocked.'; $expected_log = 'Flood control blocked login attempt for uid %uid from %ip'; } - $this->assertHttpResponseWithMessage($response, 403, $expected_message); + $this->assertHttpResponseWithMessage($response, 403, $expected_message, $format); $last_log = $database->select('watchdog', 'w') ->fields('w', ['message']) ->condition('type', 'user') @@ -424,7 +428,7 @@ public function testPerUserLoginFloodControl() { } /** - * Executes a logout HTTP request. + * Executes a logout HTTP request for a given serialization format. * * @param string $format * The format to use to make the request. @@ -456,25 +460,25 @@ protected function logoutRequest($format = 'json', $logout_token = '') { } /** - * Tests csrf protection of User Logout route. + * Tests csrf protection of User Logout route for given serialization format. */ - public function testLogoutCsrfProtection() { + public function doTestLogoutCsrfProtection(string $format): void { $client = \Drupal::httpClient(); $login_status_url = $this->getLoginStatusUrlString(); $account = $this->drupalCreateUser(); $name = $account->getAccountName(); $pass = $account->passRaw; - $response = $this->loginRequest($name, $pass); + $response = $this->loginRequest($name, $pass, $format); $this->assertEquals(200, $response->getStatusCode()); - $result_data = $this->serializer->decode($response->getBody(), 'json'); + $result_data = $this->serializer->decode($response->getBody(), $format); $logout_token = $result_data['logout_token']; // Test third party site posting to current site with logout request. // This should not logout the current user because it lacks the CSRF // token. - $response = $this->logoutRequest('json'); + $response = $this->logoutRequest($format); $this->assertEquals(403, $response->getStatusCode()); // Ensure still logged in. @@ -482,7 +486,7 @@ public function testLogoutCsrfProtection() { $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_IN); // Try with an incorrect token. - $response = $this->logoutRequest('json', 'not-the-correct-token'); + $response = $this->logoutRequest($format, 'not-the-correct-token'); $this->assertEquals(403, $response->getStatusCode()); // Ensure still logged in. @@ -490,7 +494,7 @@ public function testLogoutCsrfProtection() { $this->assertHttpResponse($response, 200, UserAuthenticationController::LOGGED_IN); // Try a logout request with correct token. - $response = $this->logoutRequest('json', $logout_token); + $response = $this->logoutRequest($format, $logout_token); $this->assertEquals(204, $response->getStatusCode()); // Ensure actually logged out. @@ -499,7 +503,7 @@ public function testLogoutCsrfProtection() { } /** - * Gets the URL string for checking login. + * Gets the URL string for checking login for a given serialization format. * * @param string $format * The format to use to make the request. diff --git a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php index 4d36bc9e28ec..e07cefc85125 100644 --- a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php @@ -111,9 +111,9 @@ public function testNoRouteFound() { $routes = $this->fixtures->contentRouteCollection(); $request = Request::create('path/two', 'POST'); - $request->headers->set('Content-type', 'application/hal+json'); + $request->headers->set('Content-type', 'text/html'); $this->expectException(UnsupportedMediaTypeHttpException::class); - $this->expectExceptionMessage('No route found that matches "Content-Type: application/hal+json"'); + $this->expectExceptionMessage('No route found that matches "Content-Type: text/html"'); $matcher->filter($routes, $request); } diff --git a/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php index 51eb801daf8f..d8d034d3ef99 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php @@ -518,7 +518,6 @@ public function testGetPhpunitTestSuite($classname, $expected) { public function providerTestGetPhpunitTestSuite() { $data = []; $data['simpletest-webtest'] = ['\Drupal\rest\Tests\NodeTest', FALSE]; - $data['simpletest-kerneltest'] = ['\Drupal\hal\Tests\FileNormalizeTest', FALSE]; $data['module-unittest'] = [static::class, 'Unit']; $data['module-kerneltest'] = ['\Drupal\KernelTests\Core\Theme\TwigMarkupInterfaceTest', 'Kernel']; $data['module-functionaltest'] = ['\Drupal\FunctionalTests\BrowserTestBaseTest', 'Functional']; -- GitLab