function EntityManagerTest::testLoadEntityByUuid

Tests the loadEntityByUuid() method.

@covers ::loadEntityByUuid

@expectedDeprecation EntityManagerInterface::loadEntityByUuid() is deprecated in 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityRepository::loadEntityByUuid() instead. See https://www.drupal.org/node/2549139.

File

core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php, line 288

Class

EntityManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityManager @group Entity @group legacy

Namespace

Drupal\Tests\Core\Entity

Code

public function testLoadEntityByUuid() {
    $entity = $this->prophesize(EntityInterface::class);
    $this->entityRepository
        ->loadEntityByUuid('entity_test', '9a9a3d06-5d27-493b-965d-7f9cb0115817')
        ->shouldBeCalled()
        ->willReturn($entity->reveal());
    $this->assertInstanceOf(EntityInterface::class, $this->entityManager
        ->loadEntityByUuid('entity_test', '9a9a3d06-5d27-493b-965d-7f9cb0115817'));
}

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