public function VideoItemSerializationTest::testVideoDeserialization in Video 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/VideoItemSerializationTest.php \Drupal\Tests\video\Kernel\VideoItemSerializationTest::testVideoDeserialization()
Tests the deserialization.
File
- tests/
src/ Kernel/ VideoItemSerializationTest.php, line 60
Class
- VideoItemSerializationTest
- Tests video field serialization.
Namespace
Drupal\Tests\video\KernelCode
public function testVideoDeserialization() {
$entity = EntityTest::create();
$json = json_decode($this->serializer
->serialize($entity, 'json'), TRUE);
$json['field_test'][0]['data'] = 'string data';
$serialized = json_encode($json, TRUE);
$this
->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "data" properties of the "field_test" field (field item class: Drupal\\video\\Plugin\\Field\\FieldType\\VideoItem).');
$this->serializer
->deserialize($serialized, EntityTest::class, 'json');
}