3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Utils_HtmlToTextTest
8 class CRM_Utils_HtmlToTextTest
extends CiviUnitTestCase
{
10 public function setUp() {
14 public function htmlToTextExamples() {
15 $cases = array(); // array(0 => string $html, 1 => string $text)
24 "This is a paragraph with <b>Bold</b> and <i>italics</i>\n" .
25 "Also some <a href=\"http://www.example.com\">hrefs</a> and a\n" .
26 "few <mailto:\"info@example.org\">mailto</mailto> tags.\n" .
27 "This is also a really long long line\n" .
29 "This is a paragraph with BOLD and _italics_ Also some hrefs [1] and a few\n" .
30 "mailto tags. This is also a really long long line\n" .
34 "[1] http://www.example.com\n" .
39 "<p>\nA <a href=\"{action.do_something}\">token</a>\nis not treated as a relative URL",
40 "A token [1] is not treated as a relative URL\n" .
44 "[1] {action.do_something}\n",
54 * Expected text output.
55 * @dataProvider htmlToTextExamples
57 public function testHtmlToText($html, $text) {
58 $output = CRM_Utils_String
::htmlToText($html);
62 "Text Output did not match for $html"