You are here

protected function HtmlToTextTest::stringToHtml in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Mail/HtmlToTextTest.php \Drupal\system\Tests\Mail\HtmlToTextTest::stringToHtml()

Converts a string to its PHP source equivalent for display in test messages.

Parameters

$text: The text string to convert.

Return value

An HTML representation of the text string that, when displayed in a browser, represents the PHP source code equivalent of $text.

2 calls to HtmlToTextTest::stringToHtml()
HtmlToTextTest::assertHtmlToText in core/modules/system/src/Tests/Mail/HtmlToTextTest.php
Helper function to test \Drupal\Core\Mail\MailFormatHelper::htmlToText().
HtmlToTextTest::testDrupalHtmlToTextBlockTagToNewline in core/modules/system/src/Tests/Mail/HtmlToTextTest.php
Test that text separated by block-level tags in HTML get separated by (at least) a newline in the plaintext version.

File

core/modules/system/src/Tests/Mail/HtmlToTextTest.php, line 32
Contains \Drupal\system\Tests\Mail\HtmlToTextTest.

Class

HtmlToTextTest
Tests for \Drupal\Core\Mail\MailFormatHelper::htmlToText().

Namespace

Drupal\system\Tests\Mail

Code

protected function stringToHtml($text) {
  return '"' . str_replace(array(
    "\n",
    ' ',
  ), array(
    '\\n',
    ' ',
  ), Html::escape($text)) . '"';
}