function BreadcrumbManagerTest::testBuildWithInvalidBreadcrumbResult

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::testBuildWithInvalidBreadcrumbResult()
  2. 10 core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::testBuildWithInvalidBreadcrumbResult()
  3. 11.x core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbManagerTest::testBuildWithInvalidBreadcrumbResult()

Tests a breadcrumb builder with a bad return value.

File

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

Class

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

Namespace

Drupal\Tests\Core\Breadcrumb

Code

public function testBuildWithInvalidBreadcrumbResult() {
    $builder = $this->createMock('Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface');
    $builder->expects($this->once())
        ->method('applies')
        ->willReturn(TRUE);
    $builder->expects($this->once())
        ->method('build')
        ->willReturn('invalid_result');
    $this->breadcrumbManager
        ->addBuilder($builder, 0);
    $this->expectException(\UnexpectedValueException::class);
    $this->breadcrumbManager
        ->build($this->createMock('Drupal\\Core\\Routing\\RouteMatchInterface'));
}

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