function BreadcrumbManagerTest::setUp

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::setUp()
  2. 10 core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::setUp()
  3. 11.x 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);
}

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