You are here

public function EntityReferenceFieldItemNormalizerTest::testDenormalizeWithEmtpyUuid in Drupal 8

@covers ::denormalize

File

core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php, line 396

Class

EntityReferenceFieldItemNormalizerTest
@coversDefaultClass \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testDenormalizeWithEmtpyUuid() {
  $this
    ->expectException(InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('If provided "target_uuid" cannot be empty for field "test_type".');
  $data = [
    'target_id' => 'test',
    'target_type' => 'test_type',
    'target_uuid' => '',
  ];
  $this->fieldItem
    ->getName()
    ->willReturn('field_reference')
    ->shouldBeCalled();
  $this
    ->assertDenormalize($data);
}