You are here

protected function ItemResourceTestBase::getExpectedNormalizedEntity in Drupal 9

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

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

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

File

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

Class

ItemResourceTestBase
ResourceTestBase for Item entity.

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' => [],
  ];
}