Version 1
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Breadcrumb / BreadcrumbTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\Breadcrumb;
4
5 use Drupal\Core\Breadcrumb\Breadcrumb;
6 use Drupal\Core\Link;
7 use Drupal\Core\Url;
8 use Drupal\Tests\UnitTestCase;
9
10 /**
11  * @coversDefaultClass \Drupal\Core\Breadcrumb\Breadcrumb
12  * @group Breadcrumb
13  */
14 class BreadcrumbTest extends UnitTestCase {
15
16   /**
17    * @covers ::setLinks
18    */
19   public function testSetLinks() {
20     $breadcrumb = new Breadcrumb();
21     $breadcrumb->setLinks([new Link('Home', Url::fromRoute('<front>'))]);
22     $this->setExpectedException(\LogicException::class, 'Once breadcrumb links are set, only additional breadcrumb links can be added.');
23     $breadcrumb->setLinks([new Link('None', Url::fromRoute('<none>'))]);
24   }
25
26 }