function ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource()
  2. 10 core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalizeInvalidResource()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.