Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Render / UrlBubbleableMetadataBubblingTest.php
diff --git a/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php b/web/core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php
new file mode 100644 (file)
index 0000000..37d20ce
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Drupal\Tests\system\Functional\Render;
+
+use Drupal\Core\Url;
+use Drupal\Tests\BrowserTestBase;
+use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
+
+/**
+ * Tests that URL bubbleable metadata is correctly bubbled.
+ *
+ * @group Render
+ */
+class UrlBubbleableMetadataBubblingTest extends BrowserTestBase {
+
+  use AssertPageCacheContextsAndTagsTrait;
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['cache_test'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+  }
+
+  /**
+   * Tests that URL bubbleable metadata is correctly bubbled.
+   */
+  public function testUrlBubbleableMetadataBubbling() {
+    // Test that regular URLs bubble up bubbleable metadata when converted to
+    // string.
+    $url = Url::fromRoute('cache_test.url_bubbling');
+    $this->drupalGet($url);
+    $this->assertCacheContext('url.site');
+    $this->assertRaw($url->setAbsolute()->toString());
+  }
+
+}