string $html, 1 => string $text)
$cases[] = array(
'
', '', ); $cases[] = array( "\n
\n" .
"This is a paragraph with Bold and italics\n" .
"Also some hrefs and a\n" .
"few \nA token\nis not treated as a relative URL",
"A token [1] is not treated as a relative URL\n" .
"\n" .
"Links:\n" .
"------\n" .
"[1] {action.do_something}\n",
);
return $cases;
}
/**
* @param string $html
* Example HTML input.
* @param string $text
* Expected text output.
* @dataProvider htmlToTextExamples
*/
public function testHtmlToText($html, $text) {
$output = CRM_Utils_String::htmlToText($html);
$this->assertEquals(
trim($output),
trim($text),
"Text Output did not match for $html"
);
}
}