function ResourceResponseTestTrait::toResourceIdentifier

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::toResourceIdentifier()
  2. 10 core/modules/jsonapi/tests/src/Functional/ResourceResponseTestTrait.php \Drupal\Tests\jsonapi\Functional\ResourceResponseTestTrait::toResourceIdentifier()
  3. 11.x 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(),
    ];
}

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