function HtmlEscapedTextTest::testToString

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php \Drupal\Tests\Component\Render\HtmlEscapedTextTest::testToString()
  2. 8.9.x core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php \Drupal\Tests\Component\Render\HtmlEscapedTextTest::testToString()
  3. 11.x core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php \Drupal\Tests\Component\Render\HtmlEscapedTextTest::testToString()

@covers ::__toString @covers ::jsonSerialize

@dataProvider providerToString

File

core/tests/Drupal/Tests/Component/Render/HtmlEscapedTextTest.php, line 26

Class

HtmlEscapedTextTest
Tests the HtmlEscapedText class.

Namespace

Drupal\Tests\Component\Render

Code

public function testToString($text, $expected, $message) : void {
    $escapable_string = new HtmlEscapedText($text);
    $this->assertEquals($expected, (string) $escapable_string, $message);
    $this->assertEquals($expected, $escapable_string->jsonSerialize());
}

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