alecpl
2011-03-05 6a4bccb7965e281f0a9ef11b90cd71058924ca16
commit | author | age
6084d7 1 <?php
A 2
3 /**
4  * Test class to test html2text class
5  *
6  * @package Tests
7  */
8 class rcube_test_html2text extends UnitTestCase
9 {
10
11     function __construct()
12     {
13         $this->UnitTestCase("HTML-to-Text conversion tests");
14
15     }
16
17     function test_html2text()
18     {
19         $data = array(
20             0 => array(
21                 'title' => 'Test entry',
22                 'in'    => '',
23                 'out'   => '',
24             ),
25             1 => array(
26                 'title' => 'Basic HTML entities',
27                 'in'    => '&quot;&amp;',
28                 'out'   => '"&',
29             ),
30             2 => array(
31                 'title' => 'HTML entity string',
32                 'in'    => '&amp;quot;',
33                 'out'   => '&quot;',
34             ),
35         );
36
37         $ht = new html2text(null, false, false);
38
39         foreach ($data as $item) {
40             $ht->set_html($item['in']);
41             $res = $ht->get_text();
42             $this->assertEqual($item['out'], $res, $item['title']);
43         }
44     }
45
46 }