You are here

public function UuidResolverTest::testResolveNoUuid in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php \Drupal\Tests\serialization\Unit\EntityResolver\UuidResolverTest::testResolveNoUuid()

Test resolve() with a class using the correct interface but no UUID.

File

core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php, line 52

Class

UuidResolverTest
@coversDefaultClass \Drupal\serialization\EntityResolver\UuidResolver @group serialization

Namespace

Drupal\Tests\serialization\Unit\EntityResolver

Code

public function testResolveNoUuid() {
  $this->entityRepository
    ->expects($this
    ->never())
    ->method('loadEntityByUuid');
  $normalizer = $this
    ->createMock('Drupal\\serialization\\EntityResolver\\UuidReferenceInterface');
  $normalizer
    ->expects($this
    ->once())
    ->method('getUuid')
    ->with([])
    ->will($this
    ->returnValue(NULL));
  $this
    ->assertNull($this->resolver
    ->resolve($normalizer, [], 'test_type'));
}