public function DenormalizeTest::testTypeHandlingWithInvalidType in Drupal 9
Same name and namespace in other branches
- 8 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 80
Class
- DenormalizeTest
- Tests HAL denormalization edge cases for EntityResource.
Namespace
Drupal\Tests\hal\KernelCode
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);
}