RenderDeprecationTest.php in Drupal 9
File
core/tests/Drupal/FunctionalTests/Core/Render/RenderDeprecationTest.php
View source
<?php
namespace Drupal\FunctionalTests\Core\Render;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Url;
class RenderDeprecationTest extends BrowserTestBase {
protected static $modules = [
'render_deprecation',
];
protected $defaultTheme = 'stark';
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());
$function_render = $this
->getSession()
->getPage()
->find('css', $id);
$this
->drupalGet(Url::fromRoute('render_deprecation.service')
->getInternalPath());
$service_render = $this
->getSession()
->getPage()
->find('css', $id);
$this
->assertEquals($service_render
->getOuterHtml(), $function_render
->getOuterHtml());
}
}