function ProceduralApiDeprecationTest::testShowDeprecation

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Render/Element/ProceduralApiDeprecationTest.php \Drupal\Tests\Core\Render\Element\ProceduralApiDeprecationTest::testShowDeprecation()

Tests the deprecation of the global show() function.

File

core/tests/Drupal/Tests/Core/Render/Element/ProceduralApiDeprecationTest.php, line 41

Class

ProceduralApiDeprecationTest
Tests the deprecation of global rendering functions.

Namespace

Drupal\Tests\Core\Render\Element

Code

public function testShowDeprecation() : void {
  $element = [];
  $this->expectUserDeprecationMessage("The global show() function is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. To show form elements, use ['#access'] = TRUE. For render elements, use ['#printed'] = FALSE. See https://www.drupal.org/node/3261271");
  $this->assertEquals([
    '#printed' => FALSE,
  ], show($element));
}

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