You are here

public function EntityReferenceFieldNormalizerTest::testDenormalizeInvalidResource in JSON:API 8

@covers ::denormalize @dataProvider denormalizeInvalidResourceProvider

File

tests/src/Unit/Normalizer/EntityReferenceFieldNormalizerTest.php, line 151

Class

EntityReferenceFieldNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\EntityReferenceFieldNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer

Code

public function testDenormalizeInvalidResource($data, $field_name) {
  $context = [
    'resource_type' => $this->resourceType,
    'related' => $field_name,
    'target_entity' => $this
      ->prophesize(FieldableEntityInterface::class)
      ->reveal(),
  ];
  $this
    ->setExpectedException(BadRequestHttpException::class);
  $this->normalizer
    ->denormalize($data, NULL, 'api_json', $context);
}