You are here

protected function EntityTestResourceTestBase::getExpectedNormalizedEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase::getExpectedNormalizedEntity()

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

6 calls to EntityTestResourceTestBase::getExpectedNormalizedEntity()
EntityTestDateonlyTest::getExpectedNormalizedEntity in core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php
Returns the expected normalization of the entity.
EntityTestDateRangeTest::getExpectedNormalizedEntity in core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php
Returns the expected normalization of the entity.
EntityTestDatetimeTest::getExpectedNormalizedEntity in core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
Returns the expected normalization of the entity.
EntityTestHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonAnonTest.php
Returns the expected normalization of the entity.
EntityTestJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestJsonInternalPropertyNormalizerTest.php
Returns the expected normalization of the entity.

... See full list

6 methods override EntityTestResourceTestBase::getExpectedNormalizedEntity()
EntityTestDateonlyTest::getExpectedNormalizedEntity in core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDateonlyTest.php
Returns the expected normalization of the entity.
EntityTestDateRangeTest::getExpectedNormalizedEntity in core/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php
Returns the expected normalization of the entity.
EntityTestDatetimeTest::getExpectedNormalizedEntity in core/modules/datetime/tests/src/Functional/EntityResource/EntityTest/EntityTestDatetimeTest.php
Returns the expected normalization of the entity.
EntityTestHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonAnonTest.php
Returns the expected normalization of the entity.
EntityTestJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestJsonInternalPropertyNormalizerTest.php
Returns the expected normalization of the entity.

... See full list

File

core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php, line 86

Class

EntityTestResourceTestBase

Namespace

Drupal\Tests\entity_test\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  $author = User::load(0);
  $normalization = [
    'uuid' => [
      [
        'value' => $this->entity
          ->uuid(),
      ],
    ],
    'id' => [
      [
        'value' => 1,
      ],
    ],
    'langcode' => [
      [
        'value' => 'en',
      ],
    ],
    'type' => [
      [
        'value' => 'entity_test',
      ],
    ],
    'name' => [
      [
        'value' => 'Llama',
      ],
    ],
    'created' => [
      $this
        ->formatExpectedTimestampItemValues((int) $this->entity
        ->get('created')->value),
    ],
    'user_id' => [
      [
        'target_id' => (int) $author
          ->id(),
        'target_type' => 'user',
        'target_uuid' => $author
          ->uuid(),
        'url' => $author
          ->toUrl()
          ->toString(),
      ],
    ],
    'field_test_text' => [],
  ];
  return $normalization;
}