You are here

protected function EntityToJsonApiTest::assertJsonApi in JSON:API 8

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::testSerialize in tests/src/Kernel/EntityToJsonApiTest.php
@covers ::serialize @covers ::normalize

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel

Code

protected function assertJsonApi(array $structured) {
  $this
    ->assertNotEmpty($structured['data']['type']);
  $this
    ->assertNotEmpty($structured['data']['id']);
  $this
    ->assertNotEmpty($structured['data']['attributes']);
  $this
    ->assertInternalType('string', $structured['links']['self']);
}