class RenderDeprecationTest
Tests deprecated render() function.
@group Render @group legacy
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 implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Core\Render\RenderDeprecationTest implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of RenderDeprecationTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Render/ RenderDeprecationTest.php, line 14
Namespace
Drupal\FunctionalTests\Core\RenderView source
class RenderDeprecationTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'render_deprecation',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests deprecated render() function.
*/
public function testRenderDeprecation() : void {
$this->expectDeprecation('The render() function is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \\Drupal\\Core\\Render\\RendererInterface::render() instead. See https://www.drupal.org/node/2939099');
$id = '#render-deprecation-test-result';
$this->drupalGet(Url::fromRoute('render_deprecation.function')->getInternalPath());
/** @var \Behat\Mink\Element\NodeElement $function_render */
$function_render = $this->getSession()
->getPage()
->find('css', $id);
$this->drupalGet(Url::fromRoute('render_deprecation.service')->getInternalPath());
/** @var \Behat\Mink\Element\NodeElement $service_render */
$service_render = $this->getSession()
->getPage()
->find('css', $id);
$this->assertEquals($service_render->getOuterHtml(), $function_render->getOuterHtml());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.