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