function UserResourceTestBase::getExpectedNormalizedEntity

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php \Drupal\Tests\user\Functional\Rest\UserResourceTestBase::getExpectedNormalizedEntity()
  2. 8.9.x core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php \Drupal\Tests\user\Functional\Rest\UserResourceTestBase::getExpectedNormalizedEntity()
  3. 11.x core/modules/user/tests/src/Functional/Rest/UserResourceTestBase.php \Drupal\Tests\user\Functional\Rest\UserResourceTestBase::getExpectedNormalizedEntity()

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

File

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

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

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