You are here

protected function BreadcrumbManagerTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php, line 49

Class

BreadcrumbManagerTest
@coversDefaultClass \Drupal\Core\Breadcrumb\BreadcrumbManager @group Breadcrumb

Namespace

Drupal\Tests\Core\Breadcrumb

Code

protected function setUp() : void {
  $this->moduleHandler = $this
    ->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
  $this->breadcrumbManager = new BreadcrumbManager($this->moduleHandler);
  $this->breadcrumb = new Breadcrumb();
  $this->container = new ContainerBuilder();
  $cache_contexts_manager = $this
    ->prophesize(CacheContextsManager::class);
  $cache_contexts_manager
    ->assertValidTokens()
    ->willReturn(TRUE);
  $cache_contexts_manager
    ->reveal();
  $this->container
    ->set('cache_contexts_manager', $cache_contexts_manager);
  \Drupal::setContainer($this->container);
}