You are here

protected function EntityToJsonApiTest::assertJsonApi in JSON:API Extras 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/EntityToJsonApiTest.php \Drupal\Tests\jsonapi_extras\Kernel\EntityToJsonApiTest::assertJsonApi()

Helper to assert if a string is valid JSON:API.

Parameters

array $structured: The JSON:API data to check.

1 call to EntityToJsonApiTest::assertJsonApi()
EntityToJsonApiTest::assertEntity in tests/src/Kernel/EntityToJsonApiTest.php
Checks entity's serialization/normalization.

File

tests/src/Kernel/EntityToJsonApiTest.php, line 264

Class

EntityToJsonApiTest
@coversDefaultClass \Drupal\jsonapi_extras\EntityToJsonApi @group jsonapi @group jsonapi_serializer @group legacy

Namespace

Drupal\Tests\jsonapi_extras\Kernel

Code

protected function assertJsonApi(array $structured) {
  static::assertNotEmpty($structured['data']['type']);
  static::assertNotEmpty($structured['data']['id']);
  static::assertNotEmpty($structured['data']['attributes']);
  $this
    ->assertTrue(is_string($structured['data']['links']['self']['href']));
}