You are here

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

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

Checks if a given array is a resource identifier.

Parameters

array $data: An array to check.

Return value

bool TRUE if the array has a type and ID, FALSE otherwise.

4 calls to ResourceResponseTestTrait::isResourceIdentifier()
ResourceResponseTestTrait::getResourceLink in tests/src/Functional/ResourceResponseTestTrait.php
Creates an individual resource link for a given resource identifier.
ResourceResponseTestTrait::toCollectionResourceResponse in tests/src/Functional/ResourceResponseTestTrait.php
Merges individual responses into a collection response.
ResourceTestBase::decorateExpectedResponseForIncludedFields in tests/src/Functional/ResourceTestBase.php
Decorates the expected response with included data and cache metadata.
ResourceTestBase::getExpectedRelatedResponses in tests/src/Functional/ResourceTestBase.php
Builds an array of expected related ResourceResponses, keyed by field name.

File

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

Class

ResourceResponseTestTrait
Utility methods for handling resource responses.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function isResourceIdentifier(array $data) {
  return array_key_exists('type', $data) && array_key_exists('id', $data);
}