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' => '"&', |
|
28 |
'out' => '"&', |
|
29 |
), |
|
30 |
2 => array( |
|
31 |
'title' => 'HTML entity string', |
|
32 |
'in' => '&quot;', |
|
33 |
'out' => '"', |
|
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 |
} |