protected function UserTest::getExpectedDocument in JSON:API 8
Same name and namespace in other branches
- 8.2 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
- tests/
src/ Functional/ UserTest.php, line 118
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' => 'http://jsonapi.org/format/1.0/',
],
],
'version' => '1.0',
],
'links' => [
'self' => $self_url,
],
'data' => [
'id' => $this->entity
->uuid(),
'type' => 'user--user',
'links' => [
'self' => $self_url,
],
'attributes' => [
'created' => 123456789,
// @todo uncomment this in https://www.drupal.org/project/jsonapi/issues/2929932
// 'created' => $this->formatExpectedTimestampItemValues(123456789),
'changed' => $this->entity
->getChangedTime(),
// @todo uncomment this in https://www.drupal.org/project/jsonapi/issues/2929932
// 'changed' => $this->formatExpectedTimestampItemValues($this->entity->getChangedTime()),
'default_langcode' => TRUE,
'langcode' => 'en',
'name' => 'Llama',
'uid' => 3,
'uuid' => $this->entity
->uuid(),
],
],
];
}