4 * Class CRM_Utils_HtmlToTextTest
7 class CRM_Utils_HtmlToTextTest
extends CiviUnitTestCase
{
9 public function setUp() {
16 public function htmlToTextExamples() {
17 $cases = array(); // array(0 => string $html, 1 => string $text)
26 "This is a paragraph with <b>Bold</b> and <i>italics</i>\n" .
27 "Also some <a href=\"http://www.example.com\">hrefs</a> and a\n" .
28 "few <mailto:\"info@example.org\">mailto</mailto> tags.\n" .
29 "This is also a really long long line\n" .
31 "This is a paragraph with BOLD and _italics_ Also some hrefs [1] and a few\n" .
32 "mailto tags. This is also a really long long line\n" .
36 "[1] http://www.example.com\n" .
41 "<p>\nA <a href=\"{action.do_something}\">token</a>\nis not treated as a relative URL",
42 "A token [1] is not treated as a relative URL\n" .
46 "[1] {action.do_something}\n",
56 * Expected text output.
57 * @dataProvider htmlToTextExamples
59 public function testHtmlToText($html, $text) {
60 $output = CRM_Utils_String
::htmlToText($html);
64 "Text Output did not match for $html"