function EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithIncorrectType
Same name in other branches
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithIncorrectType()
- 10 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithIncorrectType()
- 11.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithIncorrectType()
@covers ::denormalize
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ EntityReferenceFieldItemNormalizerTest.php, line 351
Class
- EntityReferenceFieldItemNormalizerTest
- @coversDefaultClass \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer @group serialization
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
public function testDenormalizeWithUuidWithIncorrectType() {
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('The field "field_reference" property "target_type" must be set to "test_type" or omitted.');
$data = [
'target_id' => 'test',
'target_type' => 'wrong_type',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
];
$this->fieldDefinition
->getName()
->willReturn('field_reference')
->shouldBeCalled();
$this->assertDenormalize($data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.