protected function InternalEntitiesTest::getRelated in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/InternalEntitiesTest.php \Drupal\Tests\jsonapi\Functional\InternalEntitiesTest::getRelated()
Performs an authenticated request and returns the decoded document.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to request.
string $relationship: The field name of the relationship to request.
array $options: URL options.
Return value
array The decoded response document.
1 call to InternalEntitiesTest::getRelated()
- InternalEntitiesTest::testRoutes in tests/
src/ Functional/ InternalEntitiesTest.php - Ensures that internal resources types aren't present in the routes.
File
- tests/
src/ Functional/ InternalEntitiesTest.php, line 178
Class
- InternalEntitiesTest
- Makes assertions about the JSON API behavior for internal entities.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getRelated(EntityInterface $entity, $relationship, array $options = []) {
$entity_type_id = $entity
->getEntityTypeId();
$bundle = $entity
->bundle();
$path = "/jsonapi/{$entity_type_id}/{$bundle}/{$entity->uuid()}/{$relationship}";
return $this
->jsonapiGet($path, $options);
}