function DisplayVariantTest::testPageDisplayVariantSelectionEvent

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest::testPageDisplayVariantSelectionEvent()
  2. 8.9.x core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest::testPageDisplayVariantSelectionEvent()
  3. 11.x core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest::testPageDisplayVariantSelectionEvent()

Tests selecting the variant and passing configuration.

File

core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php, line 29

Class

DisplayVariantTest
Tests selecting a display variant.

Namespace

Drupal\Tests\system\Functional\Render

Code

public function testPageDisplayVariantSelectionEvent() : void {
    // Tests that our display variant was selected, and that its configuration
    // was passed correctly. If the configuration wasn't passed, we'd get an
    // error page here.
    $this->drupalGet('<front>');
    $this->assertSession()
        ->pageTextContains('A very important, required value.');
    $this->assertSession()
        ->pageTextContains('Explicitly passed in context.');
    $this->assertSession()
        ->responseHeaderContains('X-Drupal-Cache-Tags', 'custom_cache_tag');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.