You are here

protected function EntityFormDisplayTest::getExpectedDocument in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/EntityFormDisplayTest.php \Drupal\Tests\jsonapi\Functional\EntityFormDisplayTest::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/EntityFormDisplayTest.php, line 70

Class

EntityFormDisplayTest
JSON API integration test for the "EntityFormDisplay" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedDocument() {
  $self_url = Url::fromUri('base:/jsonapi/entity_form_display/entity_form_display/' . $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' => 'entity_form_display--entity_form_display',
      'links' => [
        'self' => $self_url,
      ],
      'attributes' => [
        'bundle' => 'camelids',
        'content' => [
          'created' => [
            'type' => 'datetime_timestamp',
            'weight' => 10,
            'region' => 'content',
            'settings' => [],
            'third_party_settings' => [],
          ],
          'promote' => [
            'type' => 'boolean_checkbox',
            'settings' => [
              'display_label' => TRUE,
            ],
            'weight' => 15,
            'region' => 'content',
            'third_party_settings' => [],
          ],
          'status' => [
            'type' => 'boolean_checkbox',
            'weight' => 120,
            'region' => 'content',
            'settings' => [
              'display_label' => TRUE,
            ],
            'third_party_settings' => [],
          ],
          'sticky' => [
            'type' => 'boolean_checkbox',
            'settings' => [
              'display_label' => TRUE,
            ],
            'weight' => 16,
            'region' => 'content',
            'third_party_settings' => [],
          ],
          'title' => [
            'type' => 'string_textfield',
            'weight' => -5,
            'region' => 'content',
            'settings' => [
              'size' => 60,
              'placeholder' => '',
            ],
            'third_party_settings' => [],
          ],
          'uid' => [
            'type' => 'entity_reference_autocomplete',
            'weight' => 5,
            'settings' => [
              'match_operator' => 'CONTAINS',
              'size' => 60,
              'placeholder' => '',
            ],
            'region' => 'content',
            'third_party_settings' => [],
          ],
        ],
        'dependencies' => [
          'config' => [
            'node.type.camelids',
          ],
        ],
        'hidden' => [],
        'id' => 'node.camelids.default',
        'langcode' => 'en',
        'mode' => 'default',
        'status' => NULL,
        'targetEntityType' => 'node',
        'uuid' => $this->entity
          ->uuid(),
      ],
    ],
  ];
}