function TermTest::getExpectedGetRelationshipDocumentData

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

Overrides ResourceTestBase::getExpectedGetRelationshipDocumentData

File

core/modules/jsonapi/tests/src/Functional/TermTest.php, line 324

Class

TermTest
JSON:API integration test for the "Term" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedGetRelationshipDocumentData($relationship_field_name, ?EntityInterface $entity = NULL) {
    $data = parent::getExpectedGetRelationshipDocumentData($relationship_field_name, $entity);
    if ($relationship_field_name === 'parent') {
        $data = [
            0 => [
                'id' => 'virtual',
                'type' => 'taxonomy_term--camelids',
                'meta' => [
                    'links' => [
                        'help' => [
                            'href' => 'https://www.drupal.org/docs/8/modules/json-api/core-concepts#virtual',
                            'meta' => [
                                'about' => "Usage and meaning of the 'virtual' resource identifier.",
                            ],
                        ],
                    ],
                ],
            ],
        ];
    }
    return $data;
}

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