summaryrefslogtreecommitdiff
path: root/roundcubemail/tests
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-11-14 11:35:38 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-11-14 11:35:38 +0000
commita66fd7b8815b120becb59e92cc02b4c8a3d77679 (patch)
treedc55bb69654bda202bb78aae9846e028bb28076b /roundcubemail/tests
parente688b77125151dbbd2028f269533189fdad64904 (diff)
- Fix hanling of HTML entity strings in plai text messages
git-svn-id: https://svn.roundcube.net/trunk@4223 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/tests')
-rw-r--r--roundcubemail/tests/html_to_text.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/roundcubemail/tests/html_to_text.php b/roundcubemail/tests/html_to_text.php
new file mode 100644
index 000000000..c1d40d930
--- /dev/null
+++ b/roundcubemail/tests/html_to_text.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Test class to test html2text class
+ *
+ * @package Tests
+ */
+class rcube_test_html2text extends UnitTestCase
+{
+
+ function __construct()
+ {
+ $this->UnitTestCase("HTML-to-Text conversion tests");
+
+ }
+
+ function test_html2text()
+ {
+ $data = array(
+ 0 => array(
+ 'title' => 'Test entry',
+ 'in' => '',
+ 'out' => '',
+ ),
+ 1 => array(
+ 'title' => 'Basic HTML entities',
+ 'in' => '&quot;&amp;',
+ 'out' => '"&',
+ ),
+ 2 => array(
+ 'title' => 'HTML entity string',
+ 'in' => '&amp;quot;',
+ 'out' => '&quot;',
+ ),
+ );
+
+ $ht = new html2text(null, false, false);
+
+ foreach ($data as $item) {
+ $ht->set_html($item['in']);
+ $res = $ht->get_text();
+ $this->assertEqual($item['out'], $res, $item['title']);
+ }
+ }
+
+}