summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-12-01 20:02:34 +0100
committerAleksander Machniak <alec@alec.pl>2012-12-01 20:02:34 +0100
commit0fa54df638a0b0f514d1bfba3cefb93e38991a35 (patch)
tree0c1e03293f0e3d8f65291965b9274108dbcd5703 /tests
parente327ebd7fedaf4a5b85da07ca37d9544eb067a03 (diff)
enriched.inc -> rcube_enriched
Diffstat (limited to 'tests')
-rw-r--r--tests/Framework/Enriched.php74
-rw-r--r--tests/phpunit.xml1
2 files changed, 75 insertions, 0 deletions
diff --git a/tests/Framework/Enriched.php b/tests/Framework/Enriched.php
new file mode 100644
index 000000000..26bbc3b4e
--- /dev/null
+++ b/tests/Framework/Enriched.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * Test class to test rcube_enriched class
+ *
+ * @package Tests
+ */
+class Framework_Enriched extends PHPUnit_Framework_TestCase
+{
+
+ /**
+ * Class constructor
+ */
+ function test_class()
+ {
+ $object = new rcube_enriched();
+
+ $this->assertInstanceOf('rcube_enriched', $object, "Class constructor");
+ }
+
+ /**
+ * Test to_html()
+ */
+ function test_to_html()
+ {
+ $enriched = '<bold><italic>the-text</italic></bold>';
+ $expected = '<b><i>the-text</i></b>';
+ $result = rcube_enriched::to_html($enriched);
+
+ $this->assertSame($expected, $result);
+ }
+
+ /**
+ * Data for test_formatting()
+ */
+ function data_formatting()
+ {
+ return array(
+ array('<bold>', '<b>'),
+ array('</bold>', '</b>'),
+ array('<italic>', '<i>'),
+ array('</italic>', '</i>'),
+ array('<fixed>', '<tt>'),
+ array('</fixed>', '</tt>'),
+ array('<smaller>', '<font size=-1>'),
+ array('</smaller>', '</font>'),
+ array('<bigger>', '<font size=+1>'),
+ array('</bigger>', '</font>'),
+ array('<underline>', '<span style="text-decoration: underline">'),
+ array('</underline>', '</span>'),
+ array('<flushleft>', '<span style="text-align: left">'),
+ array('</flushleft>', '</span>'),
+ array('<flushright>', '<span style="text-align: right">'),
+ array('</flushright>', '</span>'),
+ array('<flushboth>', '<span style="text-align: justified">'),
+ array('</flushboth>', '</span>'),
+ array('<indent>', '<span style="padding-left: 20px">'),
+ array('</indent>', '</span>'),
+ array('<indentright>', '<span style="padding-right: 20px">'),
+ array('</indentright>', '</span>'),
+ );
+ }
+
+ /**
+ * Test formatting conversion
+ * @dataProvider data_formatting
+ */
+ function test_formatting($enriched, $expected)
+ {
+ $result = rcube_enriched::to_html($enriched);
+
+ $this->assertSame($expected, $result);
+ }
+}
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index 36ab6d714..c9e229e97 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -10,6 +10,7 @@
<file>Framework/Charset.php</file>
<file>Framework/ContentFilter.php</file>
<file>Framework/Csv2vcard.php</file>
+ <file>Framework/Enriched.php</file>
<file>Framework/Html.php</file>
<file>Framework/Imap.php</file>
<file>Framework/ImapGeneric.php</file>