function UserTest::getExpectedDocument
Same name in other branches
- 8.9.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::getExpectedDocument()
- 10 core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::getExpectedDocument()
- 11.x core/modules/jsonapi/tests/src/Functional/UserTest.php \Drupal\Tests\jsonapi\Functional\UserTest::getExpectedDocument()
Overrides ResourceTestBase::getExpectedDocument
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ UserTest.php, line 137
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,
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.