summaryrefslogtreecommitdiff
path: root/tests/Framework
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-01-15 14:19:36 +0100
committerAleksander Machniak <alec@alec.pl>2014-01-15 14:19:36 +0100
commit18ff2e4ac68044d94ef9edf403b6638dc9a6b91a (patch)
tree6d47591e7e9b0adab2e372368f2480c23b3012d8 /tests/Framework
parent5f3c7e3920c36641466950d4e70a595d59376a88 (diff)
Added some tests for IMAP THREAD parser
Diffstat (limited to 'tests/Framework')
-rw-r--r--tests/Framework/ResultThread.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/Framework/ResultThread.php b/tests/Framework/ResultThread.php
index f980845cc..ab55827ff 100644
--- a/tests/Framework/ResultThread.php
+++ b/tests/Framework/ResultThread.php
@@ -17,4 +17,28 @@ class Framework_ResultThread extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('rcube_result_thread', $object, "Class constructor");
}
+
+ /**
+ * thread parser test
+ */
+ function test_parse_thread()
+ {
+ $text = file_get_contents(__DIR__ . '/../src/imap_thread.txt');
+ $object = new rcube_result_thread('INBOX', $text);
+
+ $this->assertSame(false, $object->is_empty(), "Object is empty");
+ $this->assertSame(false, $object->is_error(), "Object is error");
+ $this->assertSame(1721, $object->max(), "Max message UID");
+ $this->assertSame(1, $object->min(), "Min message UID");
+ $this->assertSame(1721, $object->count_messages(), "Messages count");
+ $this->assertSame(1691, $object->exists(1720, true), "Message exists");
+ $this->assertSame(true, $object->exists(1720), "Message exists (bool)");
+ $this->assertSame(1, $object->get_element('FIRST'), "Get first element");
+ $this->assertSame(1719, $object->get_element('LAST'), "Get last element");
+ $this->assertSame(14, (int) $object->get_element(2), "Get specified element");
+
+ $object->filter(array(784));
+ $this->assertSame(118, $object->count_messages(), "Messages filter");
+ $this->assertSame(1, $object->count(), "Messages filter (count)");
+ }
}