function ProceduralApiDeprecationTest::testHideDeprecation

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::testHideDeprecation()

Tests the deprecation of the global hide() function.

File

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

Class

ProceduralApiDeprecationTest
Tests the deprecation of global rendering functions.

Namespace

Drupal\Tests\Core\Render\Element

Code

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

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