protected function TermTest::getExpectedGetRelationshipDocumentData in JSON:API 8.2
Same name and namespace in other branches
- 8 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
- tests/
src/ Functional/ TermTest.php, line 303
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' && floatval(\Drupal::VERSION) >= 8.6) {
$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;
}