function DenormalizeTest::testDenormalizeSerializedItem
Same name in other branches
- 8.9.x core/modules/hal/tests/src/Kernel/DenormalizeTest.php \Drupal\Tests\hal\Kernel\DenormalizeTest::testDenormalizeSerializedItem()
Tests normalizing/denormalizing serialized columns.
File
-
core/
modules/ hal/ tests/ src/ Kernel/ DenormalizeTest.php, line 147
Class
- DenormalizeTest
- Tests HAL denormalization edge cases for EntityResource.
Namespace
Drupal\Tests\hal\KernelCode
public function testDenormalizeSerializedItem() {
$entity = EntitySerializedField::create([
'serialized' => 'boo',
]);
$normalized = $this->serializer
->normalize($entity, $this->format);
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\\entity_test\\Plugin\\Field\\FieldType\\SerializedItem).');
$this->serializer
->denormalize($normalized, EntitySerializedField::class, $this->format);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.