function BookManagerTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/book/tests/src/Unit/BookManagerTest.php \Drupal\Tests\book\Unit\BookManagerTest::setUp()
  2. 10 core/modules/book/tests/src/Unit/BookManagerTest.php \Drupal\Tests\book\Unit\BookManagerTest::setUp()
  3. 11.x core/modules/book/tests/src/Unit/BookManagerTest.php \Drupal\Tests\book\Unit\BookManagerTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/book/tests/src/Unit/BookManagerTest.php, line 75

Class

BookManagerTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21book%21src%21BookManager.php/class/BookManager/9" title="Defines a book manager." class="local">\Drupal\book\BookManager</a> @group book

Namespace

Drupal\Tests\book\Unit

Code

protected function setUp() : void {
    $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
    $this->translation = $this->getStringTranslationStub();
    $this->configFactory = $this->getConfigFactoryStub([]);
    $this->bookOutlineStorage = $this->createMock('Drupal\\book\\BookOutlineStorageInterface');
    $this->renderer = $this->createMock('\\Drupal\\Core\\Render\\RendererInterface');
    $this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $this->entityRepository = $this->createMock('Drupal\\Core\\Entity\\EntityRepositoryInterface');
    // Used for both book manager cache services: backend chain and memory.
    $cache = $this->createMock(CacheBackendInterface::class);
    $this->bookManager = new BookManager($this->entityTypeManager, $this->translation, $this->configFactory, $this->bookOutlineStorage, $this->renderer, $this->languageManager, $this->entityRepository, $cache, $cache);
}

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