function EntityReferenceFieldItemNormalizerTest::testDenormalizeWithTypeWithIncorrectUuid
Same name in other branches
- 9 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithTypeWithIncorrectUuid()
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithTypeWithIncorrectUuid()
- 10 core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\EntityReferenceFieldItemNormalizerTest::testDenormalizeWithTypeWithIncorrectUuid()
@covers ::denormalize
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ EntityReferenceFieldItemNormalizerTest.php, line 376
Class
- EntityReferenceFieldItemNormalizerTest
- @coversDefaultClass \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer @group serialization
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
public function testDenormalizeWithTypeWithIncorrectUuid() : void {
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('No "test_type" entity found with UUID "unique-but-none-non-existent" for field "field_reference"');
$data = [
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => 'unique-but-none-non-existent',
];
$this->entityRepository
->loadEntityByUuid($data['target_type'], $data['target_uuid'])
->willReturn(NULL)
->shouldBeCalled();
$this->fieldItem
->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.