function BreadcrumbTest::testSetLinks
@covers ::setLinks
File
-
core/
tests/ Drupal/ Tests/ Core/ Breadcrumb/ BreadcrumbTest.php, line 21
Class
- BreadcrumbTest
- @coversDefaultClass \Drupal\Core\Breadcrumb\Breadcrumb[[api-linebreak]] @group Breadcrumb
Namespace
Drupal\Tests\Core\BreadcrumbCode
public function testSetLinks() : void {
$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>')),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.