You are here

protected static function ResourceResponseTestTrait::toResourceIdentifier in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/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.

7 calls to ResourceResponseTestTrait::toResourceIdentifier()
ResourceResponseTestTrait::getExpectedIncludedResourceResponse in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of expected ResourceResponses for the given include paths.
ResourceResponseTestTrait::getRelatedResponses in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of related responses for the given field names.
ResourceResponseTestTrait::getRelationshipResponses in core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php
Gets an array of relationship responses for the given field names.
ResourceTestBase::doTestRelationshipMutation in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Performs one round of relationship POST, PATCH and DELETE route testing.
ResourceTestBase::doTestSparseFieldSets in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
Tests sparse field sets.

... See full list

File

core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php, line 261

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(),
  ];
}