You are here

protected function EntityViewDisplayTest::getExpectedDocument in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php \Drupal\Tests\jsonapi\Functional\EntityViewDisplayTest::getExpectedDocument()

Returns the expected JSON:API document for the entity.

Return value

array A JSON:API response document.

Overrides ResourceTestBase::getExpectedDocument

See also

::createEntity()

1 call to EntityViewDisplayTest::getExpectedDocument()
LayoutBuilderEntityViewDisplayTest::getExpectedDocument in core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php
Returns the expected JSON:API document for the entity.
1 method overrides EntityViewDisplayTest::getExpectedDocument()
LayoutBuilderEntityViewDisplayTest::getExpectedDocument in core/modules/layout_builder/tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php
Returns the expected JSON:API document for the entity.

File

core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php, line 76

Class

EntityViewDisplayTest
JSON:API integration test for the "EntityViewDisplay" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedDocument() {
  $self_url = Url::fromUri('base:/jsonapi/entity_view_display/entity_view_display/' . $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' => 'entity_view_display--entity_view_display',
      'links' => [
        'self' => [
          'href' => $self_url,
        ],
      ],
      'attributes' => [
        'bundle' => 'camelids',
        'content' => [
          'links' => [
            'region' => 'content',
            'weight' => 100,
            'settings' => [],
            'third_party_settings' => [],
          ],
        ],
        'dependencies' => [
          'config' => [
            'node.type.camelids',
          ],
          'module' => [
            'user',
          ],
        ],
        'hidden' => [],
        'langcode' => 'en',
        'mode' => 'default',
        'status' => TRUE,
        'targetEntityType' => 'node',
        'drupal_internal__id' => 'node.camelids.default',
      ],
    ],
  ];
}