You are here

protected static function ResourceResponseTestTrait::toResourceIdentifier in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::toResourceIdentifier()

Maps an entity to a resource identifier.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to map to a resource identifier.

Return value

array A resource identifier for the given entity.

9 calls to ResourceResponseTestTrait::toResourceIdentifier()
ResourceResponseTestTrait::getAccessDeniedResponse in tests/src/Functional/ResourceResponseTestTrait.php
Gets a generic forbidden response.
ResourceResponseTestTrait::getExpectedIncludedResourceResponse in tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of expected ResourceResponses for the given include paths.
ResourceResponseTestTrait::getRelatedResponses in tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of related responses for the given field names.
ResourceResponseTestTrait::getRelationshipResponses in tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of relationship responses for the given field names.
ResourceTestBase::doTestRelationshipPost in tests/src/Functional/ResourceTestBase.php
Performs one round of relationship POST, PATCH and DELETE route testing.

... See full list

File

tests/src/Functional/ResourceResponseTestTrait.php, line 232

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function toResourceIdentifier(EntityInterface $entity) {
  return [
    'type' => $entity
      ->getEntityTypeId() . '--' . $entity
      ->bundle(),
    'id' => $entity
      ->uuid(),
  ];
}