class ProceduralApiDeprecationTest
Tests the deprecation of global rendering functions.
Attributes
#[Group("Render")]
#[Group("legacy")]
#[RunTestsInSeparateProcesses]
#[IgnoreDeprecations]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Render\Element\ProceduralApiDeprecationTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ProceduralApiDeprecationTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ Element/ ProceduralApiDeprecationTest.php, line 15
Namespace
Drupal\Tests\Core\Render\ElementView source
class ProceduralApiDeprecationTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() : void {
parent::setUp();
include_once $this->root . '/core/includes/common.inc';
}
/**
* Tests the deprecation of the global hide() function.
*/
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));
}
/**
* Tests the deprecation of the global show() function.
*/
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.