class RenderDeprecationTest

Tests deprecated render() function.

@group Render @group legacy

Hierarchy

Expanded class hierarchy of RenderDeprecationTest

File

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

Namespace

Drupal\FunctionalTests\Core\Render
View 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.