function TaxonomyTermPageVariableDeprecationTest::testPageVariableDeprecation
Tests that deprecations are thrown correctly for the page variable.
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ TaxonomyTermPageVariableDeprecationTest.php, line 41
Class
- TaxonomyTermPageVariableDeprecationTest
- Tests page variable deprecation.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
public function testPageVariableDeprecation() : void {
$term = $this->createTerm(Vocabulary::load('test_page_variable'));
$this->expectDeprecation("'page' is deprecated in drupal:11.3.0 and is removed in drupal:13.0.0. Use 'view_mode' instead. See https://www.drupal.org/node/3542527");
$this->drupalGet($term->toUrl());
$this->assertSession()
->pageTextContains('The page variable is set');
$build = \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term')
->view($term, 'test_page_variable');
$output = (string) \Drupal::service('renderer')->renderRoot($build);
$this->assertStringNotContainsString('The page variable is set', $output);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.