function DenormalizeTest::testTypeHandlingWithInvalidType

Same name and namespace in other branches
  1. 8.9.x core/modules/hal/tests/src/Kernel/DenormalizeTest.php \Drupal\Tests\hal\Kernel\DenormalizeTest::testTypeHandlingWithInvalidType()

Tests link relation handling with an invalid type.

File

core/modules/hal/tests/src/Kernel/DenormalizeTest.php, line 81

Class

DenormalizeTest
Tests HAL denormalization edge cases for EntityResource.

Namespace

Drupal\Tests\hal\Kernel

Code

public function testTypeHandlingWithInvalidType() {
    $data_with_invalid_type = [
        '_links' => [
            'type' => [
                'href' => Url::fromUri('base:rest/type/entity_test/entity_test_invalid', [
                    'absolute' => TRUE,
                ])->toString(),
            ],
        ],
    ];
    $this->expectException(UnexpectedValueException::class);
    $this->serializer
        ->denormalize($data_with_invalid_type, $this->entityClass, $this->format);
}

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