function PlainTextOutputTest::testRenderFromHtml

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php \Drupal\Tests\Component\Render\PlainTextOutputTest::testRenderFromHtml()
  2. 8.9.x core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php \Drupal\Tests\Component\Render\PlainTextOutputTest::testRenderFromHtml()
  3. 10 core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php \Drupal\Tests\Component\Render\PlainTextOutputTest::testRenderFromHtml()

Tests ::renderFromHtml().

@covers ::renderFromHtml @dataProvider providerRenderFromHtml

Parameters

$expected: The expected formatted value.

$string: A string to be formatted.

array $args: (optional) An associative array of replacements to make. Defaults to none.

File

core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php, line 33

Class

PlainTextOutputTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Component%21Render%21PlainTextOutput.php/class/PlainTextOutput/11.x" title="Provides an output strategy for transforming HTML into simple plain text." class="local">\Drupal\Component\Render\PlainTextOutput</a> @group Utility

Namespace

Drupal\Tests\Component\Render

Code

public function testRenderFromHtml($expected, $string, $args = []) : void {
    $markup = new FormattableMarkup($string, $args);
    $output = PlainTextOutput::renderFromHtml($markup);
    $this->assertSame($expected, $output);
}

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