You are here

private function UnitTestBase::getNewEntityTypeManagerMock in Select (or other) 8

Same name and namespace in other branches
  1. 4.x tests/src/Unit/UnitTestBase.php \Drupal\Tests\select_or_other\Unit\UnitTestBase::getNewEntityTypeManagerMock()
1 call to UnitTestBase::getNewEntityTypeManagerMock()
UnitTestBase::addMockServicesToContainer in tests/src/Unit/UnitTestBase.php
Adds mocked services to the container.

File

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

Class

UnitTestBase

Namespace

Drupal\Tests\select_or_other\Unit

Code

private function getNewEntityTypeManagerMock() {
  $field_storage_config = $this
    ->getMockForAbstractClass('\\Drupal\\field\\FieldStorageConfigInterface');
  $field_storage_config
    ->method('setSetting')
    ->willReturnSelf();
  $entity_storage_methods = [
    'load' => $field_storage_config,
  ];
  $entity_type_manager_methods = [
    'getStorage' => $this
      ->getMockForAbstractClassWithMethods('\\Drupal\\Core\\Entity\\EntityStorageInterface', $entity_storage_methods),
  ];
  return $this
    ->getMockForAbstractClassWithMethods('\\Drupal\\Core\\Entity\\EntityTypeManagerInterface', $entity_type_manager_methods);
}