function RenderTest::testDeprecateRenderPlain

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Render/RenderTest.php \Drupal\KernelTests\Core\Render\RenderTest::testDeprecateRenderPlain()

Tests the deprecation of \Drupal\Core\Render\Renderer::renderPlain()

@group legacy

File

core/tests/Drupal/KernelTests/Core/Render/RenderTest.php, line 82

Class

RenderTest
Performs functional tests on <a href="/api/drupal/core%21lib%21Drupal.php/function/Drupal%3A%3Aservice/11.x" title="Retrieves a service from the container." class="local">\Drupal::service</a>(&#039;renderer&#039;)-&gt;render().

Namespace

Drupal\KernelTests\Core\Render

Code

public function testDeprecateRenderPlain() : void {
    $message = [
        '#markup' => 'Test',
    ];
    \Drupal::service('renderer')->renderPlain($message);
    $this->expectDeprecation('Renderer::renderPlain() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Instead, you should use ::renderInIsolation(). See https://www.drupal.org/node/3407994');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.