You are here

protected function EntityTypeBundleInfoTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php, line 84
Contains \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest.

Class

EntityTypeBundleInfoTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeBundleInfo @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

protected function setUp() {
  parent::setUp();
  $this->moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $this->moduleHandler
    ->getImplementations('entity_type_build')
    ->willReturn([]);
  $this->moduleHandler
    ->alter('entity_type', Argument::type('array'))
    ->willReturn(NULL);
  $this->cacheBackend = $this
    ->prophesize(CacheBackendInterface::class);
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $this->cacheTagsInvalidator = $this
    ->prophesize(CacheTagsInvalidatorInterface::class);
  $language = new Language([
    'id' => 'en',
  ]);
  $this->languageManager = $this
    ->prophesize(LanguageManagerInterface::class);
  $this->languageManager
    ->getCurrentLanguage()
    ->willReturn($language);
  $this->languageManager
    ->getLanguages()
    ->willReturn([
    'en' => (object) [
      'id' => 'en',
    ],
  ]);
  $this->typedDataManager = $this
    ->prophesize(TypedDataManagerInterface::class);
  $this->cacheBackend = $this
    ->prophesize(CacheBackendInterface::class);
  $container = $this
    ->prophesize(ContainerInterface::class);
  $container
    ->get('cache_tags.invalidator')
    ->willReturn($this->cacheTagsInvalidator
    ->reveal());

  //$container->get('typed_data_manager')->willReturn($this->typedDataManager->reveal());
  \Drupal::setContainer($container
    ->reveal());
  $this->entityTypeBundleInfo = new EntityTypeBundleInfo($this->entityTypeManager
    ->reveal(), $this->languageManager
    ->reveal(), $this->moduleHandler
    ->reveal(), $this->typedDataManager
    ->reveal(), $this->cacheBackend
    ->reveal());
}