protected function TermTest::getExpectedGetRelationshipDocumentData in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Functional/TermTest.php \Drupal\Tests\jsonapi\Functional\TermTest::getExpectedGetRelationshipDocumentData()
Gets the expected document data for the given relationship.
Parameters
string $relationship_field_name: The relationship for which to get an expected response.
\Drupal\Core\Entity\EntityInterface|null $entity: (optional) The entity for which to get expected relationship data.
Return value
mixed The expected document data.
Overrides ResourceTestBase::getExpectedGetRelationshipDocumentData
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ TermTest.php, line 305
Class
- TermTest
- JSON:API integration test for the "Term" content entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
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;
}