3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Utils_HtmlToTextTest
8 class CRM_Utils_HtmlToTextTest
extends CiviUnitTestCase
{
9 protected $_testInput = array(
10 '<br><p>' => '', // empty test
13 This is a paragraph with <b>Bold</b> and <i>italics</i>
14 Also some <a href="http://www.example.com">hrefs</a> and a
15 few <mailto:"info@example.org">mailto</mailto> tags.
16 This is also a really long long line' => '
17 This is a paragraph with BOLD and _italics_ Also some hrefs [1] and a few
18 mailto tags. This is also a really long long line
22 [1] http://www.example.com
26 A <a href="{action.do_something}">token</a>
27 is not treated as a relative URL' => '
28 A token [1] is not treated as a relative URL
32 [1] {action.do_something}
36 public function setUp() {
40 public function testHtmlToText() {
41 foreach ($this->_testInput
as $html => $text) {
42 $output = CRM_Utils_String
::htmlToText($html);
46 "Text Output did not match for $html"