You are here

protected function EntityManagerTest::setUp in Drupal 8

Overrides UnitTestCase::setUp

File

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

Class

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

Namespace

Drupal\Tests\Core\Entity

Code

protected function setUp() {
  parent::setUp();
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManager::class);
  $this->entityTypeRepository = $this
    ->prophesize(EntityTypeRepositoryInterface::class);
  $this->entityTypeBundleInfo = $this
    ->prophesize(EntityTypeBundleInfoInterface::class);
  $this->entityFieldManager = $this
    ->prophesize(EntityFieldManager::class);
  $this->entityRepository = $this
    ->prophesize(EntityRepositoryInterface::class);
  $this->entityDisplayRepository = $this
    ->prophesize(EntityDisplayRepositoryInterface::class);
  $this->entityLastInstalledSchemaRepository = $this
    ->prophesize(EntityLastInstalledSchemaRepositoryInterface::class);
  $container = new ContainerBuilder();
  $container
    ->set('entity_type.manager', $this->entityTypeManager
    ->reveal());
  $container
    ->set('entity_type.repository', $this->entityTypeRepository
    ->reveal());
  $container
    ->set('entity_type.bundle.info', $this->entityTypeBundleInfo
    ->reveal());
  $container
    ->set('entity_field.manager', $this->entityFieldManager
    ->reveal());
  $container
    ->set('entity.repository', $this->entityRepository
    ->reveal());
  $container
    ->set('entity_display.repository', $this->entityDisplayRepository
    ->reveal());
  $container
    ->set('entity.last_installed_schema.repository', $this->entityLastInstalledSchemaRepository
    ->reveal());
  $this->entityManager = new EntityManager();
  $this->entityManager
    ->setContainer($container);
}