You are here

protected function UserResourceTestBase::getExpectedNormalizedEntity in Drupal 9

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

Returns the expected normalization of the entity.

Return value

array

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

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

File

core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php, line 94

Class

UserResourceTestBase

Namespace

Drupal\Tests\user\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  return [
    'uid' => [
      [
        'value' => 3,
      ],
    ],
    'uuid' => [
      [
        'value' => $this->entity
          ->uuid(),
      ],
    ],
    'langcode' => [
      [
        'value' => 'en',
      ],
    ],
    'name' => [
      [
        'value' => 'Llama',
      ],
    ],
    'created' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp(123456789)
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'changed' => [
      [
        'value' => (new \DateTime())
          ->setTimestamp($this->entity
          ->getChangedTime())
          ->setTimezone(new \DateTimeZone('UTC'))
          ->format(\DateTime::RFC3339),
        'format' => \DateTime::RFC3339,
      ],
    ],
    'default_langcode' => [
      [
        'value' => TRUE,
      ],
    ],
  ];
}