protected function MenuLinkContentTest::getExpectedDocument in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/MenuLinkContentTest.php \Drupal\Tests\jsonapi\Functional\MenuLinkContentTest::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/ MenuLinkContentTest.php, line 76
Class
- MenuLinkContentTest
- JSON API integration test for the "MenuLinkContent" content entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/menu_link_content/menu_link_content/' . $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' => 'menu_link_content--menu_link_content',
'links' => [
'self' => $self_url,
],
'attributes' => [
'bundle' => 'menu_link_content',
'id' => 1,
'link' => [
'uri' => 'https://nl.wikipedia.org/wiki/Llama',
'title' => NULL,
'options' => [],
],
'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,
'description' => 'Llama Gabilondo',
'enabled' => TRUE,
'expanded' => FALSE,
'external' => FALSE,
'langcode' => 'en',
'menu_name' => 'main',
'parent' => NULL,
'rediscover' => FALSE,
'title' => 'Llama Gabilondo',
'uuid' => $this->entity
->uuid(),
'weight' => 0,
],
],
];
}