You are here

public function RenderDeprecationTest::testRenderDeprecation in Drupal 9

Tests deprecated render() function.

File

core/tests/Drupal/FunctionalTests/Core/Render/RenderDeprecationTest.php, line 29

Class

RenderDeprecationTest
Tests deprecated render() function.

Namespace

Drupal\FunctionalTests\Core\Render

Code

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());
}