function InternalEntitiesTest::getIndividual

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php \Drupal\Tests\jsonapi\Functional\InternalEntitiesTest::getIndividual()
  2. 10 core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php \Drupal\Tests\jsonapi\Functional\InternalEntitiesTest::getIndividual()
  3. 11.x core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php \Drupal\Tests\jsonapi\Functional\InternalEntitiesTest::getIndividual()

Returns the decoded JSON:API document for the for the given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to request.

array $options: URL options.

Return value

array The decoded response document.

2 calls to InternalEntitiesTest::getIndividual()
InternalEntitiesTest::testIncludes in core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php
Asserts that internal entities are not included in compound documents.
InternalEntitiesTest::testLinks in core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php
Asserts that links to internal relationships aren't generated.

File

core/modules/jsonapi/tests/src/Functional/InternalEntitiesTest.php, line 156

Class

InternalEntitiesTest
Makes assertions about the JSON:API behavior for internal entities.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getIndividual(EntityInterface $entity, array $options = []) {
    $entity_type_id = $entity->getEntityTypeId();
    $bundle = $entity->bundle();
    $path = "/jsonapi/{$entity_type_id}/{$bundle}/{$entity->uuid()}";
    return $this->jsonapiGet($path, $options);
}

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