3 namespace Drupal\Tests\hal\Functional\EntityResource\EntityTestLabel;
5 use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait;
6 use Drupal\Tests\rest\Functional\AnonResourceTestTrait;
7 use Drupal\Tests\rest\Functional\EntityResource\EntityTestLabel\EntityTestLabelResourceTestBase;
8 use Drupal\user\Entity\User;
13 class EntityTestLabelHalJsonAnonTest extends EntityTestLabelResourceTestBase {
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();
39 $normalization = $this->applyHalFieldNormalization($default_normalization);
41 $author = User::load(0);
42 return $normalization + [
48 'href' => $this->baseUrl . '/rest/type/entity_test_label/entity_test_label',
50 $this->baseUrl . '/rest/relation/entity_test_label/entity_test_label/user_id' => [
52 'href' => $this->baseUrl . '/user/0?_format=hal_json',
58 $this->baseUrl . '/rest/relation/entity_test_label/entity_test_label/user_id' => [
62 'href' => $this->baseUrl . '/user/0?_format=hal_json',
65 'href' => $this->baseUrl . '/rest/type/user/user',
70 'value' => $author->uuid(),
83 protected function getNormalizedPostEntity() {
84 return parent::getNormalizedPostEntity() + [
87 'href' => $this->baseUrl . '/rest/type/entity_test_label/entity_test_label',
96 protected function getExpectedCacheContexts() {