function EntityTypeBundleInfoTest::setUp

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php, line 80

Class

EntityTypeBundleInfoTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeBundleInfo[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

protected function setUp() : void {
  parent::setUp();
  $this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
  $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());
}

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