You are here

public function JsonApiDocumentTopLevelNormalizerTest::testDenormalize in JSON:API 8

Same name in this branch
  1. 8 tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testDenormalize()
  2. 8 tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testDenormalize()
Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testDenormalize()

@covers ::denormalize @dataProvider denormalizeProvider

File

tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php, line 94

Class

JsonApiDocumentTopLevelNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer

Code

public function testDenormalize($input, $expected) {
  $context = [
    'resource_type' => new ResourceType($this
      ->randomMachineName(), $this
      ->randomMachineName(), FieldableEntityInterface::class),
  ];
  $denormalized = $this->normalizer
    ->denormalize($input, NULL, 'api_json', $context);
  $this
    ->assertSame($expected, $denormalized);
}