3 require_once 'CiviTest/CiviUnitTestCase.php';
5 class CRM_Utils_HtmlToTextTest
extends CiviUnitTestCase
{
6 protected $_testInput = array(
7 '<br><p>' => '', // empty test
10 This is a paragraph with <b>Bold</b> and <i>italics</i>
11 Also some <a href="http://www.example.com">hrefs</a> and a
12 few <mailto:"info@example.org">mailto</mailto> tags.
13 This is also a really long long line' => '
14 This is a paragraph with BOLD and _italics_ Also some hrefs [1] and a few
15 mailto tags. This is also a really long long line
19 [1] http://www.example.com
25 'name' => 'HtmlToText Test',
26 'description' => 'Test htmlToText Function',
27 'group' => 'CiviCRM BAO Tests',
35 function testHtmlToText() {
36 foreach ($this->_testInput
as $html => $text) {
37 $output = CRM_Utils_String
::htmlToText($html);
41 "Text Output did not match for $html"