protected function UserTest::getExpectedDocument in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::getExpectedDocument()
Returns the expected JSON:API document for the entity.
Return value
array A JSON:API response document.
Overrides ResourceTestBase::getExpectedDocument
See also
::createEntity()
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ UserTest.php, line 125
Class
- UserTest
- JSON:API integration test for the "User" content entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/user/user/' . $this->entity
->uuid())
->setAbsolute()
->toString(TRUE)
->getGeneratedUrl();
return [
'jsonapi' => [
'meta' => [
'links' => [
'self' => [
'href' => 'http://jsonapi.org/format/1.0/',
],
],
],
'version' => '1.0',
],
'links' => [
'self' => [
'href' => $self_url,
],
],
'data' => [
'id' => $this->entity
->uuid(),
'type' => 'user--user',
'links' => [
'self' => [
'href' => $self_url,
],
],
'attributes' => [
'display_name' => 'Llama',
'created' => '1973-11-29T21:33:09+00:00',
'changed' => (new \DateTime())
->setTimestamp($this->entity
->getChangedTime())
->setTimezone(new \DateTimeZone('UTC'))
->format(\DateTime::RFC3339),
'default_langcode' => TRUE,
'langcode' => 'en',
'name' => 'Llama',
'drupal_internal__uid' => 3,
],
],
];
}