protected function PathBasedBreadcrumbBuilderTest::setUp in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php \Drupal\Tests\system\Unit\Breadcrumbs\PathBasedBreadcrumbBuilderTest::setUp()
@covers ::__construct
Overrides UnitTestCase::setUp
File
- core/
modules/ system/ tests/ src/ Unit/ Breadcrumbs/ PathBasedBreadcrumbBuilderTest.php, line 100 - Contains \Drupal\Tests\system\Unit\Breadcrumbs\PathBasedBreadcrumbBuilderTest.
Class
- PathBasedBreadcrumbBuilderTest
- @coversDefaultClass \Drupal\system\PathBasedBreadcrumbBuilder @group system
Namespace
Drupal\Tests\system\Unit\BreadcrumbsCode
protected function setUp() {
parent::setUp();
$this->requestMatcher = $this
->createMock('\\Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface');
$config_factory = $this
->getConfigFactoryStub([
'system.site' => [
'front' => 'test_frontpage',
],
]);
$this->pathProcessor = $this
->createMock('\\Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface');
$this->context = $this
->createMock('\\Drupal\\Core\\Routing\\RequestContext');
$this->accessManager = $this
->createMock('\\Drupal\\Core\\Access\\AccessManagerInterface');
$this->titleResolver = $this
->createMock('\\Drupal\\Core\\Controller\\TitleResolverInterface');
$this->currentUser = $this
->createMock('Drupal\\Core\\Session\\AccountInterface');
$this->currentPath = $this
->getMockBuilder('Drupal\\Core\\Path\\CurrentPathStack')
->disableOriginalConstructor()
->getMock();
$this->pathMatcher = $this
->createMock(PathMatcherInterface::class);
$this->builder = new TestPathBasedBreadcrumbBuilder($this->context, $this->accessManager, $this->requestMatcher, $this->pathProcessor, $config_factory, $this->titleResolver, $this->currentUser, $this->currentPath, $this->pathMatcher);
$this->builder
->setStringTranslation($this
->getStringTranslationStub());
$cache_contexts_manager = $this
->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')
->disableOriginalConstructor()
->getMock();
$cache_contexts_manager
->method('assertValidTokens')
->willReturn(TRUE);
$container = new Container();
$container
->set('cache_contexts_manager', $cache_contexts_manager);
\Drupal::setContainer($container);
}