diff core/modules/system/src/Tests/Render/UrlBubbleableMetadataBubblingTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/system/src/Tests/Render/UrlBubbleableMetadataBubblingTest.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,42 @@
+<?php
+
+namespace Drupal\system\Tests\Render;
+
+use Drupal\Core\Url;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests that URL bubbleable metadata is correctly bubbled.
+ *
+ * @group Render
+ */
+class UrlBubbleableMetadataBubblingTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['cache_test'];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->dumpHeaders = TRUE;
+  }
+
+  /**
+   * 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());
+  }
+
+}