You are here

public function PathBasedBreadcrumbBuilderTest::testBuildWithOnePathElement in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php \Drupal\Tests\system\Unit\Breadcrumbs\PathBasedBreadcrumbBuilderTest::testBuildWithOnePathElement()

Tests the build method with one path element.

@covers ::build

File

core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php, line 155
Contains \Drupal\Tests\system\Unit\Breadcrumbs\PathBasedBreadcrumbBuilderTest.

Class

PathBasedBreadcrumbBuilderTest
@coversDefaultClass \Drupal\system\PathBasedBreadcrumbBuilder @group system

Namespace

Drupal\Tests\system\Unit\Breadcrumbs

Code

public function testBuildWithOnePathElement() {
  $this->context
    ->expects($this
    ->once())
    ->method('getPathInfo')
    ->will($this
    ->returnValue('/example'));
  $breadcrumb = $this->builder
    ->build($this
    ->getMock('Drupal\\Core\\Routing\\RouteMatchInterface'));
  $this
    ->assertEquals([
    0 => new Link('Home', new Url('<front>')),
  ], $breadcrumb
    ->getLinks());
  $this
    ->assertEquals([
    'url.path',
  ], $breadcrumb
    ->getCacheContexts());
  $this
    ->assertEquals([], $breadcrumb
    ->getCacheTags());
  $this
    ->assertEquals(Cache::PERMANENT, $breadcrumb
    ->getCacheMaxAge());
}