function EntityTestResourceTestBase::getExpectedNormalizedEntity

Same name 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()
  2. 8.9.x core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase::getExpectedNormalizedEntity()
  3. 10 core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase::getExpectedNormalizedEntity()

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

6 calls to EntityTestResourceTestBase::getExpectedNormalizedEntity()
EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php
Returns the expected normalization of the entity.
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.
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()
EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity in core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php
Returns the expected normalization of the entity.
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.
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 101

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' => static::$entityTypeId,
            ],
        ],
        'name' => [
            [
                'value' => 'Llama',
            ],
        ],
        'created' => [
            [
                'value' => (new \DateTime())->setTimestamp((int) $this->entity
                    ->get('created')->value)
                    ->setTimezone(new \DateTimeZone('UTC'))
                    ->format(\DateTime::RFC3339),
                'format' => \DateTime::RFC3339,
            ],
        ],
        'user_id' => [
            [
                'target_id' => (int) $author->id(),
                'target_type' => 'user',
                'target_uuid' => $author->uuid(),
                'url' => $author->toUrl()
                    ->toString(),
            ],
        ],
        'field_test_text' => [],
    ];
    return $normalization;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.