You are here

private function UnitTestBase::getEntityManagerMock in Entity Construction Kit (ECK) 8

Retrieves the entity manager mock.

File

tests/src/Unit/UnitTestBase.php, line 84

Class

UnitTestBase
Base class for unit tests.

Namespace

Drupal\Tests\eck\Unit

Code

private function getEntityManagerMock() {
  $entity_storage = $this
    ->getEntityStorageMock();
  $definition = $this
    ->getMockForAbstractClass(EntityTypeInterface::class);
  $entity_manager = $this
    ->getMockForAbstractClass(EntityTypeManagerInterface::class);
  $entity_manager
    ->method('getStorage')
    ->willReturn($entity_storage);
  $entity_manager
    ->method('getDefinition')
    ->willReturn($definition);
  return $entity_manager;
}