class DisplayVariantTest
Same name in this branch
- 9 core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php \Drupal\Tests\Core\Display\DisplayVariantTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest
- 11.x core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php \Drupal\Tests\Core\Display\DisplayVariantTest
- 10 core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest
- 10 core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php \Drupal\Tests\Core\Display\DisplayVariantTest
- 8.9.x core/modules/system/tests/src/Functional/Render/DisplayVariantTest.php \Drupal\Tests\system\Functional\Render\DisplayVariantTest
- 8.9.x core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php \Drupal\Tests\Core\Display\DisplayVariantTest
Tests selecting a display variant.
@group Render
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Functional\Render\DisplayVariantTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of DisplayVariantTest
File
-
core/
modules/ system/ tests/ src/ Functional/ Render/ DisplayVariantTest.php, line 12
Namespace
Drupal\Tests\system\Functional\RenderView source
class DisplayVariantTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'display_variant_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests selecting the variant and passing configuration.
*/
public function testPageDisplayVariantSelectionEvent() {
// 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.