HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
|
Last change
on this file since 6084d78 was
6084d78,
checked in by alecpl <alec@…>, 3 years ago
|
- Fix hanling of HTML entity strings in plai text messages
|
-
Property mode set to
100644
|
|
File size:
1019 bytes
|
| Line | |
|---|
| 1 | <?php |
|---|
| 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 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.