diff --git a/core/core.api.php b/core/core.api.php
index 7cb3814a92bbffb1e263b64cb140a9da8e443df4..dc1b6f6cb5fb037b662db17196779a3a15ffd08f 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 623d75c1c4f726e4094c28d12f12494bc7af5c32..8f3b45ff822c0740cb999de58d1b23b164d924d1 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 eda163549779f8dfe1c3b8e79f28b4b5b82a01fe..830bf0bee99f59e7b0714799dfbd357c44d54a34 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 0000000000000000000000000000000000000000..1827733d0ec4e81593e0cf358fc7f68cd84b8688
--- /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 0000000000000000000000000000000000000000..67b23b6153a6fb42f3916f9ae2ffe9aefc63e5d3
--- /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 31dd891ab7ce9baf7807a3f5fe0e73303c2c9ccc..0b1be7f4e4fb748317d0f49056b60009bd8ababc 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 0000000000000000000000000000000000000000..9444338650fa0d9d3f02ca7962d40a0c0af6e0a7
--- /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 1b781ea49104a92a1c0f6af74a4a16128110f6e2..bb97ccd53410c527bf258317bf06108aadc1f68a 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 4c50b393ddc8355975618d07d7bc1208b4db7a6b..8dfb4ed6c30f24af946ec2d9cfaeba3869b25eb6 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 afa7bfdbe4ea5be7d39c09a774a2c57a7058ad7f..0ea91c3b00730dc83a387969349ba1855b8ab0f7 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 4b30531c9ed328ec79589a91704e6fa9d8f4aec3..a62dadb25823c87f26712e018f5c2260d84fdc81 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 ce1799f6cb6d51c6c2a31293fe84679e8a12d54b..e42e5f90aafe4d0e2eb7603ca290d47f08081f84 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 cab859896c5a26ba51ab014e639d486a7766189d..c9f182c33b00d3de8c09ff6fa783bd9f05df44c6 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 97aa324e89e1b54f2aedd3e3750858e3ffdd6382..d47d909f63cd89c7521b365738bbe79a58b07247 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 78f5539f3863854cc4df8836bac09a7d8861dbab..a0566b5a0d6f74a7eea0e92ca4f64e77a6dbc638 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 8ff466c05549b0b06221cf47f5ce39b2888b8294..05793e51817fa715d1fb20d2b8d163558f398438 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 2ae1c8e08dd1f23229e3fb632ba20ec9e73d97ff..1a6f256ac64a0a7fa2198c3ace3c01dab922abef 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 a5500ce4a4a3142a022b5edc023b6018244675e1..b0cc2d1b953b94804e71989d61e3889a10c36f2a 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 298785506d7f33030e383760cf73d66dfbce2a06..487bab7fce0ed0cafad901ab873ceac869a74b4b 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 8daea2ecdb1e3c96dd51b7bff7cbbd8e04dca175..f21fa01109072a677fb94c106f6e054cb444cbb4 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 a269c032d7471e80cea94b6f4d771691c876149d..dc5cd151917df660fec299929b69d0ff60a1ecd8 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 a45e86265d0613cd401a8e4729e2460c2a97e944..c6bfd01c062a6da2f0cbef2b5dd7378efb292d28 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 f7bdd7356abf63104514340b0642ae5c07894794..a352b8742a2f5ad7fc56d3180877580bc0523d8e 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 1b829376c9f8097f94177b393ea2f6cf17c1eaac..c4b967f84791d006514d887978dd9dae000c10ca 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 55c72de5c38c9fb7b4aa84b069f2ce7808556d8f..1dffe7bd6d7feb3c9afe802b35e8887b5582a8f2 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 834cf5dd1d7ed16a006d1bcdd7747fd58453d6a5..cb3a62cb319dac09c89192ce10f2746f15eba0e3 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 4085a9a50ccfe4974f3ea07628d8206233f8f6b4..12b29b0cb9edf9be72a200c986c676f54cf7a395 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 8aa7a07c3e42cf2800edcf153973d69f75be907e..f84c83a290584288b36840492dd4ac07eb54740e 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 22357bf0f4b9b7ff77f227bc25ee17ade6cd21e9..b8a10a7790eba0349576005d0f67823c2bcd7821 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 fe6018133e0581beb863cb50cf2a5b71cc9d3907..09a36637a7eceb799cadd1c6e47921f63eb9cacf 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 2e696760f60ec16c4aecf7938c182a9a58b71d5d..547bd8147773ccb527e8157d6c92bec0d8ff913d 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 da07a955948cccd3278d91638d24ca246c8ad244..1a722419a54b2a783bae1e11a9dcb64dda6d81e5 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 207ff1eba7147e408d08557098d1b8d28135a5d1..13abfccf4ef50da95199de78b0f895567613c6c3 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 8de609d11e6843a687872e1b7adae0ea5388c135..32c6f47d7dce383db744c72d4e9dfef4808ecd11 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 7cea1b6f8452d3168593735e244e672117033c72..19caf71700fedd37f34a190c43b747ba367b88c7 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 5d7725671f45e95a4805deee13c0f24799691aef..a0be8f5fede5788d5ca4d3aa219013aaf8e04e9f 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 9e8d0ff2affc5aa6e2f94903e7843e879bd6e556..a42b690a92cac4b4893cdafc5792d3d5578495ac 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 d8716a185b58713546e0b40cc1c006e6cdcb3688..289f5d722c2ae7efb695b36141586ee685d22382 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 a751dae70c2b5f089a62ef0c81b69bef994a1c7d..839e172f777fb56fbf6205cc5c1723c8a18812b2 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 2213bda7f4ee756407b4daabfc38e49ac3bbbc98..eb32fac98d0b2f7b95ce241258894f5dea1bfb13 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 e823dcf23f9f6ca7a8fce9ffc9da5f6792bc26c1..3dfe343d5be4feb40a41d7162bcc3ab6e6dd6e24 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 86ed15cc96bbf59eb1ede716a3bb67846ca1d84f..43aae05832ae74c1299e956b4f36edd8c82a0353 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 01e069623e134bf2a6975df4b7845f7beeee7e28..a4c01b0621ed59127f9be6dc0866f19807828faa 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 ee0ea2ee7fc6d18329cad0e6bb2b1ec616d24211..700e784c9eabb080c991d3d78d7c835fc87c8bf2 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 dd67cf6f2b7f597dae08d87c9fc7898bd5a27f17..2390d7858f3b447d9746654fbd0ac40baf13c7cc 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 3f13633896239a333b3db8d116c970d672e0edfd..e6396b8fc361b01f225c9eee59e2b58dc6558223 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 38c4ea3243833f4cae9a119db84886a1a8643dd9..436db8391f5538686fd8a87f70d9b19fac899af2 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 ca9b1c90f60a063b1f06d02ac077aa533efb25b5..14b41728a8ba49a1134327b0973b604216335993 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 a5568ab4ef68ca726d79c493e27ceb236831ce85..e8420554c97df1da525d9b9c49afcd2ebfd6685a 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 8253dcb43b9006e195836378bdb153cc3022ac6c..39f01f48fd3baeda72b029b2ce4b3f7d3376574d 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 5f2b25974f3346972d2702f8c902449658dbca61..6aaaf4a7727d67044cef39193774c3837863453e 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 990c6fb84c7b75cf7d0a134abba99698dd2191cb..12e2af6661f3b4f127fcb9c81866f35d7d96fcd5 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 07025015b328427e2e805f9959c31f926b141b3c..94527d70c62f9600a0f538e7ab7af06d859e13b2 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 0f36180d6dd2ad655ed0dfc30879dc910d56bee0..235d74ff578bf45395a1795939615bb9f5bdc36d 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 8fdc3218687106a7100ff11e4ce5a248f1f9eea1..735e5914cb7c77c51b10f333cd3e456b9405eb7c 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 35866c0e82449a9d3b82975cc912730c0172b7d3..d2024e3680c2034abfe2bc68082e9929687e6b1c 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 5dc42402c7427540d9d88721c97e3afc270beffc..c5f9a73a073f9d68983b108a353ef6fd00cf9699 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 961b99237f2b9ebaaf6c735dd986b1a40a51fc10..547ae5cf4be5c92f17e359ec71133071263e5f8b 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 2d93a661c0fa946b1950c6032cdfce6b16568803..7f2b17827f68a8dbf89f7a8e0c2908702f76434b 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 4294949ef995dabc0490ac401d2e45e51d4e2d83..e8c449141d82c91ca0c16f0a7a75ef5fa2086a2c 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 d4523d5273dd0efbb20ad5f7ea10c561a99833cb..ceb92812ea674ea08387107474f1aef3cf287f42 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 21ef9b701b5507fe411e72be9b5e08d4327b650c..758446e5dcb62866346ad471f6665e0b29e02fe6 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 5bb6f2215e363a905e9ca1a706e060f1588e4f3c..647080a272408d1fbf7a3b6a95b0365bee5058dd 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 032b885aad74f6572079ad46c6d36933959ab792..abe8e656f853cafbb23a9a19497ca9cb225fddfc 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 7f7a502b3585431862e829c8f03bb703944d3261..797b384bb5c9d9b117e34114deacaef1f2c19813 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 d1dc648911eab34a9f74167fc5757191d2781e4a..02fe14b6ec948a2d28be113b5e8a1847693e8351 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 bae772cbd94e674f462e1eb9c8822f02e42d2470..7e8d87a1e00307f76daef922eaa0066decc7385f 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 505251835c260dd094971ee8ab698ed64a9e19eb..da1c57e893835ebe8a2d681aec6ba887eccd15ce 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 10bf4a1ca2ccbe351bd4ef0d96884987da40e988..9937120c8c15d4e1b7034efeeb3c3d9d5e556cdb 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 65437c6b77ca92e32ae14fce39bb1a422ac9fd93..2b5a9ed9398c81c9615c99e88b55383940a6469b 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 2204d72f08d3e0816b4d372b70e0d5a1aa1e0d41..efbeea4eb5027f922fc046a765c8ab9202aefb0a 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 fd2a59c4a5e45ac4b88ca220a959f4e3cb8cc86b..7b22e80f05f9d177994d6d10a362d759116fbbbf 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 f46f586a35e21930f388c272271943864ab95883..def0d9c5e6f2e7b306f43f7fdf901c1b95016c28 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 27f30dda972c5942bb34408c4bf1ccdc57c04842..80b91254a053ddff7a12ecdda131cb91763cbdb8 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 aabf6bd5c6b670e551361f33045c04c51e3ecf4f..841ec9f158f5d9fdefa90673de854781c61a3488 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 458f0d5cb175ccde42199c5dfb823c3458e3bdd8..7c85d108e6f0192725d0d10fb4db2af20a39aefe 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 5bb1dd9056218f8c9867abb321c811168cec878f..ea7deed3546012bef7687fd1262e8a85713ce1ca 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 2423375d32a88f0b9e84dbb2254d2f30c469d0cb..4eba35dd893bd80b3bde3a941172a21a16abb786 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 94c2d8a4d450ce01c0aaee2e2dc3abd2c7867436..5a748f1045d39b5166b40ac3578b1064c2023918 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 a8a70850353450975d5ba517e979996ba886ce38..772017c0e4437e23ec28bc3f01c80140d46395eb 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 cd9dcac8f5c4823c1bef5fb1aa42479b87defa14..3f7ab6f62e974bf6aa9788b36fdedd43e3da1851 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 494fbf1ae972b5b1165ff29fcd80a89a01857b6b..27547a2005fae39fa897f6ced09d98f68b9ef9ae 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 47abaf3a3c010c165f602662634601ea69d3b6fb..9f05beff85db6bc1344a4180001de727b64d0cd5 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 aa884d428b9157b9a0e272234b5f3d3204f72960..f03f934a92138b4585afe7a070cf2dd4b2ce566f 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 b9937c09a51223f3760cf1d0256ec1abb6e80875..c5ac1c1be57e5d6c922ae669348bbd4a62c063c9 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 f7491213891f9babeb12aa3a2dffec0751117a8c..cadd2bd7114c86cbcaa126a606a1cdbebbb7b089 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 d7425687c1829fb22cc905f852c3960318eac669..ee85168cd41a567495f5ec15abf5e6543e585deb 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 67e0fff94b08da658f77f7b1051cc7f3d00f5135..a4750a030a1d7740b4cb2d250027757f1e9866f6 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 59906b475b0be80a083f22807bb42d1bbb12e53b..07faf62c7ac5a7ff1993b0cfdd54d8750d977975 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 3d470cd4d6dc335fe964118cde8e789af72beeb5..0404caea798b6a68a47ae93707b5d6f570a0f705 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 c834b846ba5c18bacc30d44da1a89747ededdd4b..ef914a95cb0020d6728b0554f05275534e494e71 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 21801ebdbd40782f1c506b89672b7af4ea773188..430bea146fd12d9eea1085b0f5914109112f2530 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 06a98c75612052b3a3f999f2617eb5f38338de60..f6577108dbcb004e6c9c341884d69cd1b3d46f48 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 20c3d75d7707eab874f7bf204e32f795dca37853..6c5aafe0f7796992f031bc0482b6c4263f15ed94 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 6af58e060b0c538324baa2cdbcddf162fb1de3fc..f87a20347bb5d40080bbf4bdafbbea37e4a8edfc 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 8202050df78009ab9aa84f6769fb68edf1c5cfbd..84d378d3257db981c9ef51183b72d5784850afce 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 f59e1b8442e90e477d06a7de0cb4670d886d34fd..ec94ebda2206c31c40783b92cee35eac152baf95 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 5a14838d78d88c73715b132a5af4bfefd02dd696..7511b86929a63c42a6530309b059fba02476ed01 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 95c66ddb09d8ba75a682c6a33115e64929507d9f..9bab0a222267924b285f0a6abb71a80863f2eee6 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 6721bfaa02549a9b7b93ed33c48172b987e20cc9..7ad4481103eb74a94e9fb7d590f817db9b5a7d9c 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 ad272d297e6aa831255cfd3933360fd4e98b6fe5..b70b1f4b1347015d1dc7b488068d6bff479954b1 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 f1c0ce3af26b0bbb6e710f639f5d4d8d4e5c8e14..f19839fe9af241aac64d2de6cc467613f70ac719 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 d44534890a55a87c53cb5117073808aeabbf91a2..9739eb65f5333966789001279f47d1b6c1c1c595 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 16a76ec71b2eabd99245fdb190a3d72d33bb4c83..b6d036db711b3f295bed5a1d15dda2d54d440197 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 6d28e5d3a38ea746e59df37d12c8108963f2fdf9..e7fc765ac5a273da4c9bb0e587252c33405e7dbf 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 80e12e66d19d95632e0e7f537618d2420bb624f7..a006862911bfc3b36e69f818d52f89ba488909cd 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 c50b78093d6884d29bbc2938c1bcbc62d70edfc4..c51b365a6f26bc0c294b693d4df7b21ef493cf4d 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 d819850453c9f8353ae35fcd4e8fcc4b29d691b3..8a603fc419af674eded58a24b239359d66256973 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 dc4997261b948576cbdf5680c2af7dd973b881d0..e60fb72fc1d1c91dfcb191b682d0163d92fe7f11 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 aeb7d858e8a35c796eb6f50ccb2fe9d5b00be8db..7ec644b6f98a0eb531290fc98fd29853acb69f8d 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 0f12461524ea9731705b7d9b67ecf9b3d3d991cd..c36e35b081489cff31327f3e8f45a3bae7ef3081 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 50851bbd14970bbf5fa910e411164ccb04c547c0..7ed8039defba7bf41c3749421beb9c6c14876fe3 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 1c49e78c7d4ff6d37caf2e269d735600d34ecde4..71e5471688cae33ba97019de45b3eefc6299ed46 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 e2920829a77c28fa35deaa92284215dc0921ae82..7acdc7fb67cb500b29396daa1832e368f1353910 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 b1f90b68687c274eacbc710ab826b59003c62d95..a0448e1c663e3062af59770c3f4ddab0286e8a63 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 3c5b821446ddc5c775413b0ef2d20cb9275b602c..b20cc3e9c2bfc1e643c2d588e3c69b93478f7672 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 0000000000000000000000000000000000000000..4aaaab6166a42a80453980a99699ad7d53fe2b48
--- /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 456d33d6161ea67156cd47f2d9f7c85a86d87c76..3d6d4771e4cd3e0fe72cbd6fe97034a127d2918a 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 23dc427ef9a74b424e3b15b547087de827caab6e..fa588d17ab17f7c40c09b6f5255d8941df891746 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 e4567cd2b5863061c39d19ef6ebd2b20de0c7758..15f673b4b766713cd32148a39031f18e5e6c3902 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 69874cfecd833d707df9e8ce5f9d9c3d04227031..809ab20b7e7a3127df0ad22da7fa4a281cee56f0 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 38d0ebeab635183219645a5159cbfef00e3dfb34..37a6d79197b87f61d89a44af2d41793c3b0f4a9b 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 308cedff6a9fec30e28ab59811cc7abe1d673a0a..a70cdcc8805c96da34786b4b5c0beefd4e44b230 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 0d8f9e257c4cbd4c09e880d21e4e38d228be9e58..aa36d9aae7e258c44749b326f9453f7b535505d3 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 bed419e9f6aea33a2ad5ea63e5c9b67bae373f75..9bf6301c88e0856f533c13e479c5414ecf6f83de 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 44b3a82c40cbbc6da81382ced84c72e40413b209..8887139d61cb75564326d84d30914997f94e7112 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 c3bd2a0903714a1ceccf564cb01ecb7689b79deb..1a3ce6772c4c718937da221238c377f2e2b166d2 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 6e67a9e0cbb7b814cf5cfcab1012adbd3129f291..5b2f224660e96bb5cc3ea466560205e00b100ffe 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 22fbc9d687226d5a9e032f8b4fc79e82a90de19e..82763e033bb28a2ed2d104909213099839ac5f5e 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 062682638e856e416a0b8b4bd5927f828b4c1e66..a9c88853c768d10151d7f19d08055b8f1bbf67c8 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 0000000000000000000000000000000000000000..d83aa4e641ef9cc54d1efe6b116e1e14dc1e3488
--- /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 8539bef5e510a054e78ab660309374a285dad69b..178937b25761358996411de5ec38a73e00b994be 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 276ac6bdfb2b5ff6e86b369d9dc14bcd21d7ac68..486f59f2d2d753c7750d2925efe1206cc68d8ebf 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 8051df57829698991548a4f9c1b75ea975f3cf1d..e1a9514df428a0c874628d5e2c3962e1aba43d97 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 9d3006b2e9f9eb84714b7a25d5a3d328b682b49e..3b7acd682e9b3fb05141170136e2486fbd4cbf57 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 09295a2f14a6f701f147ffefb418df1f6795aa41..50d0a79463044705dce3d812051751c83c5e9671 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 01f152dd493bdceb609c67b4529f37efd02357a0..12bebbad27f8cb457f138858bd7a9370e160b05e 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 4782b18ea4cc336b55bf72e107dd719d5561d3a8..2058c28352c5f36e1daa5352bc1d57098aa831d4 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 4ee80a0ce16a3ce6abbee579981521fb7522f4ff..82debce163166ce69e5a88f989d26ec7df35a6a3 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 9c8189965e245ada0eb2326ec80321222744f8bd..9ea7a4ad1ba0530c9088cf4d0efe95dc86aa6e82 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 b425aec37e26a0488d36ad9ac1d09db7e3840c13..33331eb415523be73eabda819f0bc16d114385b4 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 55c84bf60635690abcc2e78658ed5248339df949..c601103dcd8f716cc430bc2e77cdfb65a197807f 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 8a35bc8ad3dfd4c92b5e45ccb3bbaf512a308eb0..624f8aff08c53c1fa88671d21e67042c9502f089 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 356447e141bcd5137ef568bdd348b9bb98c38b46..fbec680acab1faed67c1f2b5cef463a2e9039fbd 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 c5ea4652fd24ca79bf4fd7909152a1a423654f5c..8c2713e2b3d2b9cba8bfcee98a446ff60590d043 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 4a064dfce4041294d81b3b6d210df1958d3cc48d..f5bdd48fff3d1f45e671bb387f672c4d0fe19dd5 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 ff8d4e2889016ff6bc99f9072d83b152f690b667..dfe55ef676355dd760c4eee742b5aba835c9a7c5 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 626fba45ae1df40f53d20a717fc4625c1fad1f66..b1830a7b005530f62733a2e6baeb777e4b5d08b0 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 face86285a48844f466fad5b22323cdd2d94861d..4f6f49a66db9012a549436431f881b075977f8f8 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 b94677c7025c109af5fd3f9c081471303a39fa75..97623154511af7db8983106e64e8024cf10b119a 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 044a73203507e4ac5b8fb326d406c08d7dc958b4..4dcf9ea02ab2de93a8c9a55605fa7a3e07b84b5b 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 c14248c42e7dba525d748c7aec12398dc9a4b04f..d47db42abd72fecc5811d68a24f722e6123beadd 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 14ed83c28bdee941b35fd6c088ab7778c8c5c4b7..16fb1ec150538d2b5728d058c0d44877a51745bd 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 ce311eb90bafdd5fda5df8e059933fbff5b920a3..84aa433c89ef8962e2bb1ed39f073aada7f17553 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 855cff3256701537628028270e762396eb493097..a7804d640b74fb76edf19497e538d071218843ea 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 14629c6776d326d41fa512f330bff276246f6296..f0534c8a33c6be99b8ecf6cb6d5a551878f0c0f8 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 4e32528bb4f4c11dfefc6bb9786e57677a4ae104..52510591be46b1ba89537defcc3a0e0b485026fd 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 7ff1fd7f7051695e9defa6679f29df876d83ed10..4fb1f51dc3cf2fb8830ab185b5fb80a13ac3c4fc 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 9d0a62ea5839591c02cd2cd73aaa184cc64a1730..fa21afd186e78a450de09bf63c0c639a2929c48b 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 0e7202fa417381e9383ffcbb6b69ebcb375d51d2..72a84514e3e1175156336c3e8c1ac4bf3e12c5ee 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 de75e2b4520147cd4ebabe9a57f0479a82404a7c..3ccb208cd8fbeb7904cb886a9bf35469e4061260 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 2945db5a6ed7fe23ab1a3f03b0d95ab798c6807e..aa60d6f1e6b1e7fcd0fdd3f69aec94d00af67f09 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 0000000000000000000000000000000000000000..0d9bc99d4686059010e41c3ddf65dbaae9c11fc1
--- /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 612474f95c5b17b4d032fd9a1c87d1bac7929515..420b538c82abe75377c8220b055a9e4e788e4761 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 345955c5fa10616986962c9d41064ea562653709..98f6c4fa8e28773c71b2f2fc948b846ef738ba47 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 2dd38bd513edd05650ff0e7e340434a4df315247..068f35ea19624c9a33caebd9e7d08952df180eb1 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 52f416f7aead2506ae29029b9d37c093fa646d66..8d06e45924d6af2b09e91a9e6f45ee693a6404cc 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 c4b15c266966e29ea3e4f1b2fa4b8aa9e60d4c9b..1351de6d9118fb1c2f86eb004ac1475ed8635715 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 db1a75c1d1202542c1c5aaa79fabb311208c8113..856a3a3a322222404bc3e7941f96be11696bda47 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 0b687306f0b05705590c42a068d8619a1da8092d..d6517ccb115d21e591bd80cf45d1b050898fb41a 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 0000000000000000000000000000000000000000..583d9915faeb0b3c7f936beddd3e7eca323f2a61
--- /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 0000000000000000000000000000000000000000..ac5ff35ea125a684714ad1db4b57345a54135ce9
--- /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 0000000000000000000000000000000000000000..16f0d09cef63360b10f5728d5529cc75752a7792
--- /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 0000000000000000000000000000000000000000..8211b9d1200e5a1fe344d70545fb11f43daa3f73
--- /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 0000000000000000000000000000000000000000..b8bb09ba1000bdf6ca534bcbd308f1f4b606eeeb
--- /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 a052e445a90a755fb451d36845d524ff554c98f7..a0f4e87f743d9db043da261cc7d18629a9a924e7 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 d96ff7601229008e5a6e8bd2444920cb18195429..cad23273daf519394b5ebdc7b01be592c0c4c105 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 bfdf97fb45cd453e161baa5baf11c360c71b5537..8b9add719aec29ca25ddf453d375714c9d57eac1 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 1ed9aebc00e1ed6d83c216118fe683e21f9d28fd..1ebe619d4d7841041006ab95f256466fd484932e 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 bcbf57e6da0ceaf9676a0925008aa823bd498496..0a6cad991c0e0a5b09d617995bffdc9f42eb0985 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 ca0bac7221a2a106be2c94f10e5900e7929d2248..e854cb71cc0bd9e610dcbc933fad75f4467dd584 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 f7de6943ff0648c17b4c291b0cf54c16fc515bba..7fa5de9df74c08850fe3fd8ee94b712fe697a239 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 e5cdb1f2f914c29478e96e3b2e5db3f0dd371fb2..e089a85fe73719ff064a549e7fd3fe40b5fb604f 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 cba5404977c64d3bf0a851b7a6ca031cae658c1b..5e8a5ad336a9d95b21fe28b4a94f816425814089 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 440cd6a0f19849cbc37adc42c787b749d7d2a32f..7baa66ed6632f729d76b7dee50f8451238d25aaa 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 f6123c8218c0f371d9cf33334a90f8c62640d45a..0eb95961e05320789c6e40062a365f334c840e0c 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 e3b880282f9855d832ce82f10b719d438ff38036..ab7185e80f5cb7e6947930a140e45cca12049acf 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 45f2bb7c581315c016fb53bcc4c921b055ea7f17..0f60fbe72e82a899f733faa0195c52858532e044 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 38d842dddf30a42d592cdaa0f776b6af85e76d3b..a86f823422615cae4747ce1392e7bd7a6aa8faa5 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 7751707a13987c42df15d1837d31000a6826f6f3..b2f87f28d131461c61f9620e35b6ab3d3c047dac 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 4d36bc9e28ec07ada8eb663e0f1a26b3db235b3e..e07cefc85125849e00c04fe5bce7afc077182300 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 51eb801daf8f310a7ce8117821bb2492cd15726f..d8d034d3ef995865a07cb133ee97ee46ae344c4b 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'];