function ItemResourceTestBase::getExpectedNormalizedEntity

Same name in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php \Drupal\Tests\aggregator\Functional\Rest\ItemResourceTestBase::getExpectedNormalizedEntity()

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

1 call to ItemResourceTestBase::getExpectedNormalizedEntity()
ItemHalJsonTestBase::getExpectedNormalizedEntity in core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonTestBase.php
Returns the expected normalization of the entity.
1 method overrides ItemResourceTestBase::getExpectedNormalizedEntity()
ItemHalJsonTestBase::getExpectedNormalizedEntity in core/modules/hal/tests/src/Functional/aggregator/ItemHalJsonTestBase.php
Returns the expected normalization of the entity.

File

core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php, line 96

Class

ItemResourceTestBase
ResourceTestBase for Item entity. @group legacy

Namespace

Drupal\Tests\aggregator\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
    $feed = Feed::load($this->entity
        ->getFeedId());
    return [
        'iid' => [
            [
                'value' => 1,
            ],
        ],
        'langcode' => [
            [
                'value' => 'en',
            ],
        ],
        'fid' => [
            [
                'target_id' => 1,
                'target_type' => 'aggregator_feed',
                'target_uuid' => $feed->uuid(),
                'url' => base_path() . 'aggregator/sources/1',
            ],
        ],
        'title' => [
            [
                'value' => 'Llama',
            ],
        ],
        'link' => [
            [
                'value' => 'https://www.drupal.org/',
            ],
        ],
        'author' => [],
        'description' => [],
        'timestamp' => [
            [
                'value' => (new \DateTime())->setTimestamp(123456789)
                    ->setTimezone(new \DateTimeZone('UTC'))
                    ->format(\DateTime::RFC3339),
                'format' => \DateTime::RFC3339,
            ],
        ],
        'guid' => [],
    ];
}

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