function UuidResolverTest::testResolveNoUuid

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php \Drupal\Tests\serialization\Unit\EntityResolver\UuidResolverTest::testResolveNoUuid()
  2. 8.9.x core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php \Drupal\Tests\serialization\Unit\EntityResolver\UuidResolverTest::testResolveNoUuid()
  3. 11.x core/modules/serialization/tests/src/Unit/EntityResolver/UuidResolverTest.php \Drupal\Tests\serialization\Unit\EntityResolver\UuidResolverTest::testResolveNoUuid()

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

File

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

Class

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

Namespace

Drupal\Tests\serialization\Unit\EntityResolver

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.