function EntitySerializationTest::testDenormalizeSerializedItem

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php \Drupal\Tests\serialization\Kernel\EntitySerializationTest::testDenormalizeSerializedItem()
  2. 8.9.x core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php \Drupal\Tests\serialization\Kernel\EntitySerializationTest::testDenormalizeSerializedItem()
  3. 10 core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php \Drupal\Tests\serialization\Kernel\EntitySerializationTest::testDenormalizeSerializedItem()

Tests denormalizing serialized columns.

File

core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php, line 284

Class

EntitySerializationTest
Tests that entities can be serialized to supported core formats.

Namespace

Drupal\Tests\serialization\Kernel

Code

public function testDenormalizeSerializedItem() : void {
    $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([
        'serialized' => [
            [
                'value' => 'boo',
            ],
        ],
        'type' => 'entity_test_serialized_field',
    ], EntitySerializedField::class);
}

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