function EntityViewDisplayTest::getExpectedDocument

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php \Drupal\Tests\jsonapi\Functional\EntityViewDisplayTest::getExpectedDocument()
  2. 10 core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php \Drupal\Tests\jsonapi\Functional\EntityViewDisplayTest::getExpectedDocument()
  3. 11.x core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php \Drupal\Tests\jsonapi\Functional\EntityViewDisplayTest::getExpectedDocument()

Overrides ResourceTestBase::getExpectedDocument

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',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.