Version 1
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Breadcrumb / BreadcrumbTest.php
diff --git a/web/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php b/web/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
new file mode 100644 (file)
index 0000000..67c7d98
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\Tests\Core\Breadcrumb;
+
+use Drupal\Core\Breadcrumb\Breadcrumb;
+use Drupal\Core\Link;
+use Drupal\Core\Url;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Breadcrumb\Breadcrumb
+ * @group Breadcrumb
+ */
+class BreadcrumbTest extends UnitTestCase {
+
+  /**
+   * @covers ::setLinks
+   */
+  public function testSetLinks() {
+    $breadcrumb = new Breadcrumb();
+    $breadcrumb->setLinks([new Link('Home', Url::fromRoute('<front>'))]);
+    $this->setExpectedException(\LogicException::class, 'Once breadcrumb links are set, only additional breadcrumb links can be added.');
+    $breadcrumb->setLinks([new Link('None', Url::fromRoute('<none>'))]);
+  }
+
+}