You are here

function DrupalHtmlToTextTestCase::stringToHtml in Drupal 7

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 DrupalHtmlToTextTestCase::stringToHtml()
DrupalHtmlToTextTestCase::assertHtmlToText in modules/simpletest/tests/mail.test
Helper function for testing drupal_html_to_text().
DrupalHtmlToTextTestCase::testDrupalHtmlToTextBlockTagToNewline in modules/simpletest/tests/mail.test
Test that text separated by block-level tags in HTML get separated by (at least) a newline in the plaintext version.

File

modules/simpletest/tests/mail.test, line 182
Test the Drupal mailing system.

Class

DrupalHtmlToTextTestCase
Unit tests for drupal_html_to_text().

Code

function stringToHtml($text) {
  return '"' . str_replace(array(
    "\n",
    ' ',
  ), array(
    '\\n',
    ' ',
  ), check_plain($text)) . '"';
}