3 namespace Drupal\Tests\aggregator\Functional\Hal;
5 use Drupal\aggregator\Entity\Feed;
6 use Drupal\Tests\aggregator\Functional\Rest\ItemResourceTestBase;
7 use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait;
8 use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
11 * ResourceTestBase for Item entity.
13 abstract class ItemHalJsonTestBase extends ItemResourceTestBase {
15 use HalEntityNormalizationTrait;
16 use AnonResourceTestTrait;
21 public static $modules = ['hal'];
26 protected static $format = 'hal_json';
31 protected static $mimeType = 'application/hal+json';
36 protected function getExpectedNormalizedEntity() {
37 $default_normalization = parent::getExpectedNormalizedEntity();
38 $normalization = $this->applyHalFieldNormalization($default_normalization);
39 $feed = Feed::load($this->entity->getFeedId());
41 return $normalization + [
43 $this->baseUrl . '/rest/relation/aggregator_item/aggregator_item/fid' => [
47 'href' => $this->baseUrl . '/aggregator/sources/1?_format=hal_json',
50 'href' => $this->baseUrl . '/rest/type/aggregator_feed/aggregator_feed',
55 'value' => $feed->uuid(),
66 'href' => $this->baseUrl . '/rest/type/aggregator_item/aggregator_item',
68 $this->baseUrl . '/rest/relation/aggregator_item/aggregator_item/fid' => [
70 'href' => $this->baseUrl . '/aggregator/sources/' . $feed->id() . '?_format=hal_json',
80 protected function getNormalizedPostEntity() {
81 return parent::getNormalizedPostEntity() + [
84 'href' => $this->baseUrl . '/rest/type/aggregator_item/aggregator_item',
93 protected function getExpectedCacheContexts() {