Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php \Drupal\Tests\system\Functional\Render\UrlBubbleableMetadataBubblingTest
  2. 9 core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php \Drupal\Tests\system\Functional\Render\UrlBubbleableMetadataBubblingTest

Tests that URL bubbleable metadata is correctly bubbled.

@group Render

Hierarchy

Expanded class hierarchy of UrlBubbleableMetadataBubblingTest

File

core/modules/system/tests/src/Functional/Render/UrlBubbleableMetadataBubblingTest.php, line 16

Namespace

Drupal\Tests\system\Functional\Render
View source
class UrlBubbleableMetadataBubblingTest extends BrowserTestBase {
  use AssertPageCacheContextsAndTagsTrait;

  /**
   * Modules to enable.
   *
   * @var array
   */
  protected static $modules = [
    'cache_test',
  ];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    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
      ->assertSession()
      ->responseContains($url
      ->setAbsolute()
      ->toString());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AssertPageCacheContextsAndTagsTrait::assertCacheContext protected function Asserts whether an expected cache context was present in the last response.
AssertPageCacheContextsAndTagsTrait::assertCacheContexts protected function Ensures that some cache contexts are present in the current response.
AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge protected function Asserts the max age header.
AssertPageCacheContextsAndTagsTrait::assertCacheTags protected function Ensures that some cache tags are present in the current response.
AssertPageCacheContextsAndTagsTrait::assertNoCacheContext protected function Asserts that a cache context was not present in the last response.
AssertPageCacheContextsAndTagsTrait::assertPageCacheContextsAndTags protected function Asserts page cache miss, then hit for the given URL; checks cache headers.
AssertPageCacheContextsAndTagsTrait::enablePageCaching protected function Enables page caching.
AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues protected function Gets a specific header value as array.
UrlBubbleableMetadataBubblingTest::$defaultTheme protected property
UrlBubbleableMetadataBubblingTest::$modules protected static property Modules to enable.
UrlBubbleableMetadataBubblingTest::setUp protected function
UrlBubbleableMetadataBubblingTest::testUrlBubbleableMetadataBubbling public function Tests that URL bubbleable metadata is correctly bubbled.