function ResourceIdentifierNormalizerTest::testDenormalize

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalize()
  2. 10 core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalize()
  3. 11.x core/modules/jsonapi/tests/src/Unit/Normalizer/ResourceIdentifierNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\ResourceIdentifierNormalizerTest::testDenormalize()

@covers ::denormalize @dataProvider denormalizeProvider

File

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

Class

ResourceIdentifierNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer

Code

public function testDenormalize($input, $field_name, $expected) {
    $entity = $this->prophesize(FieldableEntityInterface::class);
    $context = [
        'resource_type' => $this->resourceType,
        'related' => $field_name,
        'target_entity' => $entity->reveal(),
    ];
    $denormalized = $this->normalizer
        ->denormalize($input, NULL, 'api_json', $context);
    $this->assertEquals($expected, $denormalized);
}

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