Commit 55a4f988 authored by catch's avatar catch

Issue #2854830 by Wim Leers: Move rest/serialization module's "link manager" services to HAL module

parent 7562fb24
# Set the domain for Serialization type and relation links. # Set the domain for HAL type and relation links.
# If left blank, the site's domain will be used. # If left blank, the site's domain will be used.
link_domain: ~ link_domain: ~
# Schema for the configuration files of the Serialization module. # Schema for the configuration files of the HAL module.
serialization.settings: hal.settings:
type: config_object type: config_object
label: 'Serialization settings' label: 'HAL settings'
mapping: mapping:
link_domain: link_domain:
type: string type: string
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* @file * @file
* Describes hooks provided by the Serialization module. * Describes hooks provided by the HAL module.
*/ */
/** /**
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
/** /**
* Alter the serialization type URI. * Alter the HAL type URI.
* *
* Modules may wish to alter the type URI generated for a resource based on the * Modules may wish to alter the type URI generated for a resource based on the
* context of the serializer/normalizer operation. * context of the serializer/normalizer operation.
...@@ -26,16 +26,16 @@ ...@@ -26,16 +26,16 @@
* @see \Symfony\Component\Serializer\NormalizerInterface::normalize() * @see \Symfony\Component\Serializer\NormalizerInterface::normalize()
* @see \Symfony\Component\Serializer\DenormalizerInterface::denormalize() * @see \Symfony\Component\Serializer\DenormalizerInterface::denormalize()
*/ */
function hook_serialization_type_uri_alter(&$uri, $context = array()) { function hook_hal_type_uri_alter(&$uri, $context = array()) {
if ($context['mymodule'] == TRUE) { if ($context['mymodule'] == TRUE) {
$base = \Drupal::config('serialization.settings')->get('link_domain'); $base = \Drupal::config('hal.settings')->get('link_domain');
$uri = str_replace($base, 'http://mymodule.domain', $uri); $uri = str_replace($base, 'http://mymodule.domain', $uri);
} }
} }
/** /**
* Alter the serialization relation URI. * Alter the HAL relation URI.
* *
* Modules may wish to alter the relation URI generated for a resource based on * Modules may wish to alter the relation URI generated for a resource based on
* the context of the serializer/normalizer operation. * the context of the serializer/normalizer operation.
...@@ -50,9 +50,9 @@ function hook_serialization_type_uri_alter(&$uri, $context = array()) { ...@@ -50,9 +50,9 @@ function hook_serialization_type_uri_alter(&$uri, $context = array()) {
* @see \Symfony\Component\Serializer\NormalizerInterface::normalize() * @see \Symfony\Component\Serializer\NormalizerInterface::normalize()
* @see \Symfony\Component\Serializer\DenormalizerInterface::denormalize() * @see \Symfony\Component\Serializer\DenormalizerInterface::denormalize()
*/ */
function hook_serialization_relation_uri_alter(&$uri, $context = array()) { function hook_hal_relation_uri_alter(&$uri, $context = array()) {
if ($context['mymodule'] == TRUE) { if ($context['mymodule'] == TRUE) {
$base = \Drupal::config('serialization.settings')->get('link_domain'); $base = \Drupal::config('hal.settings')->get('link_domain');
$uri = str_replace($base, 'http://mymodule.domain', $uri); $uri = str_replace($base, 'http://mymodule.domain', $uri);
} }
} }
......
<?php
/**
* @file
* Update functions for the HAL module.
*/
/**
* @defgroup updates-8.2.x-to-8.3.x Updates from 8.2.x to 8.3.x
* @{
* Update functions from 8.2.x to 8.3.x.
*/
/**
* Move 'link_domain' from 'rest.settings' to 'hal.settings'.
*/
function hal_update_8301() {
$config_factory = \Drupal::configFactory();
// The default value for the 'link_domain' key is `~`, which is the YAML
// equivalent of PHP's `NULL`. If the REST module is not installed, this is
// the value we will store in 'hal.settings'.
$link_domain = NULL;
// But if the REST module was installed, we migrate its 'link_domain' setting,
// because we are actually moving that setting from 'rest.settings' to
// 'hal.settings'.
$rest_settings = $config_factory->getEditable('rest.settings');
if ($rest_settings->getRawData() !== []) {
$link_domain = $rest_settings->get('link_domain');
// Remove the 'link_domain' setting from 'rest.settings'.
$rest_settings->clear('link_domain')
->save();
}
$hal_settings = $config_factory->getEditable('hal.settings');
$hal_settings->set('link_domain', $link_domain);
$hal_settings->save(TRUE);
}
/**
* @} End of "defgroup updates-8.2.x-to-8.3.x".
*/
services: services:
serializer.normalizer.entity_reference_item.hal: serializer.normalizer.entity_reference_item.hal:
class: Drupal\hal\Normalizer\EntityReferenceItemNormalizer class: Drupal\hal\Normalizer\EntityReferenceItemNormalizer
arguments: ['@serialization.link_manager', '@serializer.entity_resolver'] arguments: ['@hal.link_manager', '@serializer.entity_resolver']
tags: tags:
- { name: normalizer, priority: 10 } - { name: normalizer, priority: 10 }
serializer.normalizer.field_item.hal: serializer.normalizer.field_item.hal:
...@@ -16,13 +16,24 @@ services: ...@@ -16,13 +16,24 @@ services:
class: Drupal\hal\Normalizer\FileEntityNormalizer class: Drupal\hal\Normalizer\FileEntityNormalizer
tags: tags:
- { name: normalizer, priority: 20 } - { name: normalizer, priority: 20 }
arguments: ['@entity.manager', '@http_client', '@serialization.link_manager', '@module_handler'] arguments: ['@entity.manager', '@http_client', '@hal.link_manager', '@module_handler']
serializer.normalizer.entity.hal: serializer.normalizer.entity.hal:
class: Drupal\hal\Normalizer\ContentEntityNormalizer class: Drupal\hal\Normalizer\ContentEntityNormalizer
arguments: ['@serialization.link_manager', '@entity.manager', '@module_handler'] arguments: ['@hal.link_manager', '@entity.manager', '@module_handler']
tags: tags:
- { name: normalizer, priority: 10 } - { name: normalizer, priority: 10 }
serializer.encoder.hal: serializer.encoder.hal:
class: Drupal\hal\Encoder\JsonEncoder class: Drupal\hal\Encoder\JsonEncoder
tags: tags:
- { name: encoder, priority: 10, format: hal_json } - { name: encoder, priority: 10, format: hal_json }
# Link managers.
hal.link_manager:
class: Drupal\hal\LinkManager\LinkManager
arguments: ['@hal.link_manager.type', '@hal.link_manager.relation']
hal.link_manager.type:
class: Drupal\hal\LinkManager\TypeLinkManager
arguments: ['@cache.default', '@module_handler', '@config.factory', '@request_stack', '@entity_type.bundle.info']
hal.link_manager.relation:
class: Drupal\hal\LinkManager\RelationLinkManager
arguments: ['@cache.default', '@entity.manager', '@module_handler', '@config.factory', '@request_stack']
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
/** /**
* Defines an interface for a link manager with a configurable domain. * Defines an interface for a link manager with a configurable domain.
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
class LinkManager implements LinkManagerInterface { class LinkManager implements LinkManagerInterface {
/** /**
* The type link manager. * The type link manager.
* *
* @var \Drupal\serialization\LinkManager\TypeLinkManagerInterface * @var \Drupal\hal\LinkManager\TypeLinkManagerInterface
*/ */
protected $typeLinkManager; protected $typeLinkManager;
/** /**
* The relation link manager. * The relation link manager.
* *
* @var \Drupal\serialization\LinkManager\RelationLinkManagerInterface * @var \Drupal\hal\LinkManager\RelationLinkManagerInterface
*/ */
protected $relationLinkManager; protected $relationLinkManager;
/** /**
* Constructor. * Constructor.
* *
* @param \Drupal\serialization\LinkManager\TypeLinkManagerInterface $type_link_manager * @param \Drupal\hal\LinkManager\TypeLinkManagerInterface $type_link_manager
* Manager for handling bundle URIs. * Manager for handling bundle URIs.
* @param \Drupal\serialization\LinkManager\RelationLinkManagerInterface $relation_link_manager * @param \Drupal\hal\LinkManager\RelationLinkManagerInterface $relation_link_manager
* Manager for handling bundle URIs. * Manager for handling bundle URIs.
*/ */
public function __construct(TypeLinkManagerInterface $type_link_manager, RelationLinkManagerInterface $relation_link_manager) { public function __construct(TypeLinkManagerInterface $type_link_manager, RelationLinkManagerInterface $relation_link_manager) {
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
/** /**
* Defines an abstract base-class for Serialization link manager objects. * Defines an abstract base-class for HAL link manager objects.
*/ */
abstract class LinkManagerBase { abstract class LinkManagerBase {
...@@ -44,7 +44,7 @@ public function setLinkDomain($domain) { ...@@ -44,7 +44,7 @@ public function setLinkDomain($domain) {
*/ */
protected function getLinkDomain() { protected function getLinkDomain() {
if (empty($this->linkDomain)) { if (empty($this->linkDomain)) {
if ($domain = $this->configFactory->get('serialization.settings')->get('link_domain')) { if ($domain = $this->configFactory->get('hal.settings')->get('link_domain')) {
$this->linkDomain = rtrim($domain, '/'); $this->linkDomain = rtrim($domain, '/');
} }
else { else {
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
/** /**
* Interface implemented by link managers. * Interface implemented by link managers.
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
...@@ -69,7 +69,7 @@ public function getRelationUri($entity_type, $bundle, $field_name, $context = ar ...@@ -69,7 +69,7 @@ public function getRelationUri($entity_type, $bundle, $field_name, $context = ar
// different (e.g., include a language prefix), then the module must also // different (e.g., include a language prefix), then the module must also
// override the RelationLinkManager class/service to return the desired URL. // override the RelationLinkManager class/service to return the desired URL.
$uri = $this->getLinkDomain() . "/rest/relation/$entity_type/$bundle/$field_name"; $uri = $this->getLinkDomain() . "/rest/relation/$entity_type/$bundle/$field_name";
$this->moduleHandler->alter('serialization_relation_uri', $uri, $context); $this->moduleHandler->alter('hal_relation_uri', $uri, $context);
// @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This
// hook is invoked to maintain backwards compatibility // hook is invoked to maintain backwards compatibility
$this->moduleHandler->alter('rest_relation_uri', $uri, $context); $this->moduleHandler->alter('rest_relation_uri', $uri, $context);
...@@ -104,7 +104,7 @@ public function getRelationInternalIds($relation_uri, $context = array()) { ...@@ -104,7 +104,7 @@ public function getRelationInternalIds($relation_uri, $context = array()) {
* by corresponding relation URI. * by corresponding relation URI.
*/ */
protected function getRelations($context = array()) { protected function getRelations($context = array()) {
$cid = 'serialization:links:relations'; $cid = 'hal:links:relations';
$cache = $this->cache->get($cid); $cache = $this->cache->get($cid);
if (!$cache) { if (!$cache) {
$this->writeCache($context); $this->writeCache($context);
...@@ -138,7 +138,7 @@ protected function writeCache($context = array()) { ...@@ -138,7 +138,7 @@ protected function writeCache($context = array()) {
} }
// These URIs only change when field info changes, so cache it permanently // These URIs only change when field info changes, so cache it permanently
// and only clear it when the fields cache is cleared. // and only clear it when the fields cache is cleared.
$this->cache->set('serialization:links:relations', $data, Cache::PERMANENT, array('entity_field_info')); $this->cache->set('hal:links:relations', $data, Cache::PERMANENT, array('entity_field_info'));
} }
} }
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
interface RelationLinkManagerInterface extends ConfigurableLinkManagerInterface { interface RelationLinkManagerInterface extends ConfigurableLinkManagerInterface {
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\CacheBackendInterface;
...@@ -70,7 +70,7 @@ public function getTypeUri($entity_type, $bundle, $context = array()) { ...@@ -70,7 +70,7 @@ public function getTypeUri($entity_type, $bundle, $context = array()) {
// (e.g., include a language prefix), then the module must also override the // (e.g., include a language prefix), then the module must also override the
// TypeLinkManager class/service to return the desired URL. // TypeLinkManager class/service to return the desired URL.
$uri = $this->getLinkDomain() . "/rest/type/$entity_type/$bundle"; $uri = $this->getLinkDomain() . "/rest/type/$entity_type/$bundle";
$this->moduleHandler->alter('serialization_type_uri', $uri, $context); $this->moduleHandler->alter('hal_type_uri', $uri, $context);
// @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. This
// hook is invoked to maintain backwards compatibility // hook is invoked to maintain backwards compatibility
$this->moduleHandler->alter('rest_type_uri', $uri, $context); $this->moduleHandler->alter('rest_type_uri', $uri, $context);
...@@ -99,7 +99,7 @@ public function getTypeInternalIds($type_uri, $context = array()) { ...@@ -99,7 +99,7 @@ public function getTypeInternalIds($type_uri, $context = array()) {
* corresponding type URI. * corresponding type URI.
*/ */
protected function getTypes($context = array()) { protected function getTypes($context = array()) {
$cid = 'serialization:links:types'; $cid = 'hal:links:types';
$cache = $this->cache->get($cid); $cache = $this->cache->get($cid);
if (!$cache) { if (!$cache) {
$data = $this->writeCache($context); $data = $this->writeCache($context);
...@@ -143,7 +143,7 @@ protected function writeCache($context = array()) { ...@@ -143,7 +143,7 @@ protected function writeCache($context = array()) {
} }
// These URIs only change when entity info changes, so cache it permanently // These URIs only change when entity info changes, so cache it permanently
// and only clear it when entity_info is cleared. // and only clear it when entity_info is cleared.
$this->cache->set('serialization:links:types', $data, Cache::PERMANENT, array('entity_types')); $this->cache->set('hal:links:types', $data, Cache::PERMANENT, array('entity_types'));
return $data; return $data;
} }
......
<?php <?php
namespace Drupal\serialization\LinkManager; namespace Drupal\hal\LinkManager;
interface TypeLinkManagerInterface extends ConfigurableLinkManagerInterface { interface TypeLinkManagerInterface extends ConfigurableLinkManagerInterface {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\serialization\LinkManager\LinkManagerInterface; use Drupal\hal\LinkManager\LinkManagerInterface;
use Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait; use Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait;
use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Exception\UnexpectedValueException;
...@@ -27,7 +27,7 @@ class ContentEntityNormalizer extends NormalizerBase { ...@@ -27,7 +27,7 @@ class ContentEntityNormalizer extends NormalizerBase {
/** /**
* The hypermedia link manager. * The hypermedia link manager.
* *
* @var \Drupal\serialization\LinkManager\LinkManagerInterface * @var \Drupal\hal\LinkManager\LinkManagerInterface
*/ */
protected $linkManager; protected $linkManager;
...@@ -41,7 +41,7 @@ class ContentEntityNormalizer extends NormalizerBase { ...@@ -41,7 +41,7 @@ class ContentEntityNormalizer extends NormalizerBase {
/** /**
* Constructs an ContentEntityNormalizer object. * Constructs an ContentEntityNormalizer object.
* *
* @param \Drupal\serialization\LinkManager\LinkManagerInterface $link_manager * @param \Drupal\hal\LinkManager\LinkManagerInterface $link_manager
* The hypermedia link manager. * The hypermedia link manager.
*/ */
public function __construct(LinkManagerInterface $link_manager, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) { public function __construct(LinkManagerInterface $link_manager, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Drupal\hal\Normalizer; namespace Drupal\hal\Normalizer;
use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\serialization\LinkManager\LinkManagerInterface; use Drupal\hal\LinkManager\LinkManagerInterface;
use Drupal\serialization\EntityResolver\EntityResolverInterface; use Drupal\serialization\EntityResolver\EntityResolverInterface;
use Drupal\serialization\EntityResolver\UuidReferenceInterface; use Drupal\serialization\EntityResolver\UuidReferenceInterface;
...@@ -22,7 +22,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer implements UuidR ...@@ -22,7 +22,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer implements UuidR
/** /**
* The hypermedia link manager. * The hypermedia link manager.
* *
* @var \Drupal\serialization\LinkManager\LinkManagerInterface * @var \Drupal\hal\LinkManager\LinkManagerInterface
*/ */
protected $linkManager; protected $linkManager;
...@@ -36,7 +36,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer implements UuidR ...@@ -36,7 +36,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer implements UuidR
/** /**
* Constructs an EntityReferenceItemNormalizer object. * Constructs an EntityReferenceItemNormalizer object.
* *
* @param \Drupal\serialization\LinkManager\LinkManagerInterface $link_manager * @param \Drupal\hal\LinkManager\LinkManagerInterface $link_manager
* The hypermedia link manager. * The hypermedia link manager.
* @param \Drupal\serialization\EntityResolver\EntityResolverInterface $entity_Resolver * @param \Drupal\serialization\EntityResolver\EntityResolverInterface $entity_Resolver
* The entity resolver. * The entity resolver.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\serialization\LinkManager\LinkManagerInterface; use Drupal\hal\LinkManager\LinkManagerInterface;
use GuzzleHttp\ClientInterface; use GuzzleHttp\ClientInterface;
/** /**
...@@ -33,7 +33,7 @@ class FileEntityNormalizer extends ContentEntityNormalizer { ...@@ -33,7 +33,7 @@ class FileEntityNormalizer extends ContentEntityNormalizer {
* The entity manager. * The entity manager.
* @param \GuzzleHttp\ClientInterface $http_client * @param \GuzzleHttp\ClientInterface $http_client
* The HTTP Client. * The HTTP Client.
* @param \Drupal\serialization\LinkManager\LinkManagerInterface $link_manager * @param \Drupal\hal\LinkManager\LinkManagerInterface $link_manager
* The hypermedia link manager. * The hypermedia link manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler. * The module handler.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @file * @file
* Contains database additions to drupal-8.bare.standard.php.gz for testing the * Contains database additions to drupal-8.bare.standard.php.gz for testing the
* upgrade path of serialization_update_8301(). * upgrade path of hal_update_8301().
*/ */
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
// Set the schema version. // Set the schema version.
$connection->insert('key_value') $connection->insert('key_value')
->fields([
'collection' => 'system.schema',
'name' => 'hal',
'value' => 'i:8000;',
])
->fields([ ->fields([
'collection' => 'system.schema', 'collection' => 'system.schema',
'name' => 'serialization', 'name' => 'serialization',
...@@ -27,6 +32,7 @@ ...@@ -27,6 +32,7 @@
->execute() ->execute()
->fetchField(); ->fetchField();
$extensions = unserialize($extensions); $extensions = unserialize($extensions);
$extensions['module']['hal'] = 0;
$extensions['module']['serialization'] = 0; $extensions['module']['serialization'] = 0;
$connection->update('config') $connection->update('config')
->fields([ ->fields([
......
name: HAL test module
type: module
description: "Support module for HAL tests."
package: Testing
version: VERSION
core: 8.x
...@@ -2,33 +2,33 @@ ...@@ -2,33 +2,33 @@
/** /**
* @file * @file
* Contains hook implementations for testing Serialization module. * Contains hook implementations for testing HAL module.
*/ */
/** /**
* Implements hook_serialization_type_uri_alter(). * Implements hook_hal_type_uri_alter().
*/ */
function serialization_test_serialization_type_uri_alter(&$uri, $context = array()) { function hal_test_hal_type_uri_alter(&$uri, $context = array()) {
if (!empty($context['serialization_test'])) { if (!empty($context['hal_test'])) {
$uri = 'serialization_test_type'; $uri = 'hal_test_type';
} }
} }
/** /**
* Implements hook_rest_relation_uri_alter(). * Implements hook_hal_relation_uri_alter().
*/ */
function serialization_test_serialization_relation_uri_alter(&$uri, $context = array()) { function hal_test_hal_relation_uri_alter(&$uri, $context = array()) {
if (!empty($context['serialization_test'])) { if (!empty($context['hal_test'])) {
$uri = 'serialization_test_relation'; $uri = 'hal_test_relation';
} }
} }
/** /**
* Implements hook_rest_type_uri_alter(). * Implements hook_rest_type_uri_alter().
* *
* @deprecated Kept only for BC test coverage, see \Drupal\Tests\serialization\Kernel\SerializationLinkManagerTest::testGetTypeUri(). * @deprecated Kept only for BC test coverage, see \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetTypeUri().
*/ */
function serialization_test_rest_type_uri_alter(&$uri, $context = array()) { function hal_test_rest_type_uri_alter(&$uri, $context = array()) {
if (!empty($context['rest_test'])) { if (!empty($context['rest_test'])) {
$uri = 'rest_test_type'; $uri = 'rest_test_type';
} }
...@@ -37,9 +37,9 @@ function serialization_test_rest_type_uri_alter(&$uri, $context = array()) { ...@@ -37,9 +37,9 @@ function serialization_test_rest_type_uri_alter(&$uri, $context = array()) {
/** /**
* Implements hook_rest_relation_uri_alter(). * Implements hook_rest_relation_uri_alter().
* *
* @deprecated Kept only for BC test coverage, see \Drupal\Tests\serialization\Kernel\SerializationLinkManagerTest::testGetRelationUri(). * @deprecated Kept only for BC test coverage, see \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetRelationUri().
*/ */
function serialization_test_rest_relation_uri_alter(&$uri, $context = array()) { function hal_test_rest_relation_uri_alter(&$uri, $context = array()) {
if (!empty($context['rest_test'])) { if (!empty($context['rest_test'])) {
$uri = 'rest_test_relation'; $uri = 'rest_test_relation';
} }
......
...@@ -92,7 +92,7 @@ protected function removeFieldsFromNormalization(array $normalization, $field_na ...@@ -92,7 +92,7 @@ protected function removeFieldsFromNormalization(array $normalization, $field_na
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) { protected function assertNormalizationEdgeCases($method, Url $url, array $request_options) {
// \Drupal\serialization\Normalizer\EntityNormalizer::denormalize(): entity // \Drupal\hal\Normalizer\EntityNormalizer::denormalize(): entity
// types with bundles MUST send their bundle field to be denormalizable. // types with bundles MUST send their bundle field to be denormalizable.
if ($this->entity->getEntityType()->hasKey('bundle')) { if ($this->entity->getEntityType()->hasKey('bundle')) {
$normalization = $this->getNormalizedPostEntity(); $normalization = $this->getNormalizedPostEntity();
......
<?php <?php
namespace Drupal\Tests\serialization\Functional\Update; namespace Drupal\Tests\hal\Functional\Update;
use Drupal\system\Tests\Update\UpdatePathTestBase; use Drupal\system\Tests\Update\UpdatePathTestBase;
/** /**
* Tests that 'serialization.settings' is created, to store 'link_domain'. * Tests that 'hal.settings' is created, to store 'link_domain'.
* *
* @see https://www.drupal.org/node/2758897 * @see https://www.drupal.org/node/2758897
* *
* @group serialization * @group hal
*/ */
class CreateSerializationSettingsForLinkDomainUpdateTest extends UpdatePathTestBase { cla