function EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithoutType
Same name and namespace in other branches
- 9 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithoutType()
- 10 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithoutType()
- 11.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithUuidWithoutType()
@covers ::denormalize
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ EntityReferenceFieldItemNormalizerTest.php, line 325
Class
- EntityReferenceFieldItemNormalizerTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21serialization%21src%21Normalizer%21EntityReferenceFieldItemNormalizer.php/class/EntityReferenceFieldItemNormalizer/8.9.x" title="Adds the file URI to embedded file entities." class="local">\Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer</a> @group serialization
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
public function testDenormalizeWithUuidWithoutType() {
$data = [
'target_id' => 'test',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
];
$entity = $this->prophesize(FieldableEntityInterface::class);
$entity->id()
->willReturn('test')
->shouldBeCalled();
$this->entityRepository
->loadEntityByUuid('test_type', $data['target_uuid'])
->willReturn($entity)
->shouldBeCalled();
$this->fieldItem
->getProperties()
->willReturn([
'target_id' => $this->prophesize(IntegerInterface::class),
]);
$this->fieldItem
->setValue([
'target_id' => 'test',
])
->shouldBeCalled();
$this->assertDenormalize($data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.