a55037f74b4d53874a2652c8f1796149d0a0a6d4
[yaffs-website] / web / core / modules / system / src / Tests / Render / UrlBubbleableMetadataBubblingTest.php
1 <?php
2
3 namespace Drupal\system\Tests\Render;
4
5 use Drupal\Core\Url;
6 use Drupal\simpletest\WebTestBase;
7
8 /**
9  * Tests that URL bubbleable metadata is correctly bubbled.
10  *
11  * @group Render
12  */
13 class UrlBubbleableMetadataBubblingTest extends WebTestBase {
14
15   /**
16    * Modules to enable.
17    *
18    * @var array
19    */
20   public static $modules = ['cache_test'];
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function setUp() {
26     parent::setUp();
27     $this->dumpHeaders = TRUE;
28   }
29
30   /**
31    * Tests that URL bubbleable metadata is correctly bubbled.
32    */
33   public function testUrlBubbleableMetadataBubbling() {
34     // Test that regular URLs bubble up bubbleable metadata when converted to
35     // string.
36     $url = Url::fromRoute('cache_test.url_bubbling');
37     $this->drupalGet($url);
38     $this->assertCacheContext('url.site');
39     $this->assertRaw($url->setAbsolute()->toString());
40   }
41
42 }