You are here

public function ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource()
  2. 9 core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource()

@covers ::denormalize @dataProvider denormalizeInvalidResourceProvider

File

core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php, line 151

Class

ResourceIdentifierNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer @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
    ->expectException(BadRequestHttpException::class);
  $this->normalizer
    ->denormalize($data, NULL, 'api_json', $context);
}