Helper function for testing drupal_html_to_text().
$html: The source HTML string to be converted.
$text: The expected result of converting $html to text.
$message: A text message to display in the assertion message.
$allowed_tags: (optional) An array of allowed tags, or NULL to default to the full set of tags supported by drupal_html_to_text().
protected function assertHtmlToText($html, $text, $message, $allowed_tags = NULL) {
preg_match_all('/<([a-z0-6]+)/', drupal_strtolower($html), $matches);
$tested_tags = implode(', ', array_unique($matches[1]));
$message .= ' (' . $tested_tags . ')';
$result = drupal_html_to_text($html, $allowed_tags);
$pass = $this
->assertEqual($result, $text, check_plain($message));
$verbose = 'html = <pre>' . $this
->stringToHtml($html) . '</pre><br />' . 'result = <pre>' . $this
->stringToHtml($result) . '</pre><br />' . 'expected = <pre>' . $this
->stringToHtml($text) . '</pre>';
$this
->verbose($verbose);
if (!$pass) {
$this
->pass("Previous test verbose info:<br />{$verbose}");
}
}