You are here

public function BreadcrumbTest::testSetLinks in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbTest::testSetLinks()
  2. 10 core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php \Drupal\Tests\Core\Breadcrumb\BreadcrumbTest::testSetLinks()

@covers ::setLinks

File

core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php, line 19

Class

BreadcrumbTest
@coversDefaultClass \Drupal\Core\Breadcrumb\Breadcrumb @group Breadcrumb

Namespace

Drupal\Tests\Core\Breadcrumb

Code

public function testSetLinks() {
  $breadcrumb = new Breadcrumb();
  $breadcrumb
    ->setLinks([
    new Link('Home', Url::fromRoute('<front>')),
  ]);
  $this
    ->expectException(\LogicException::class);
  $this
    ->expectExceptionMessage('Once breadcrumb links are set, only additional breadcrumb links can be added.');
  $breadcrumb
    ->setLinks([
    new Link('None', Url::fromRoute('<none>')),
  ]);
}