function EntityReferenceFieldItemNormalizerTest::testConstructValueProperties
Same name in other branches
- 9 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testConstructValueProperties()
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testConstructValueProperties()
- 11.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testConstructValueProperties()
@covers ::constructValue
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ EntityReferenceFieldItemNormalizerTest.php, line 483
Class
- EntityReferenceFieldItemNormalizerTest
- @coversDefaultClass \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer @group serialization
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
public function testConstructValueProperties() : void {
$data = [
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
'extra_property' => 'extra_value',
];
$entity = $this->prophesize(FieldableEntityInterface::class);
$entity->id()
->willReturn('test')
->shouldBeCalled();
$this->entityRepository
->loadEntityByUuid($data['target_type'], $data['target_uuid'])
->willReturn($entity)
->shouldBeCalled();
$this->fieldItem
->getProperties()
->willReturn([
'target_id' => $this->prophesize(IntegerInterface::class),
'extra_property' => $this->prophesize(StringInterface::class),
]);
$this->fieldItem
->setValue([
'target_id' => 'test',
'extra_property' => 'extra_value',
])
->shouldBeCalled();
$this->assertDenormalize($data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.