function EntityTypeBundleInfoTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::setUp()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php \Drupal\Tests\Core\Entity\EntityTypeBundleInfoTest::setUp()
  3. 11.x 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 78

Class

EntityTypeBundleInfoTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityTypeBundleInfo.php/class/EntityTypeBundleInfo/9" title="Provides discovery and retrieval of entity type bundles." class="local">\Drupal\Core\Entity\EntityTypeBundleInfo</a> @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.