parent::
setUp();
$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);
} /**
* Tests the getBookParents() method.
*
* @dataProvider providerTestGetBookParents
*/
public function testGetBookParents($book,
$parent,
$expected) { $this->
assertEquals($expected,
$this->bookManager->
getBookParents($book,
$parent));
}