summaryrefslogtreecommitdiff
path: root/tests/Framework/ImapGeneric.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-07-04 08:45:41 +0200
committerAleksander Machniak <alec@alec.pl>2013-07-04 08:45:41 +0200
commit6e57fb6b4cc8c108b89458651dd525a0df950fdd (patch)
treed86abd9fd28d23ddc82dd0b592a45c03d0bd6db2 /tests/Framework/ImapGeneric.php
parent3e7b9be05c68fca5617c3c01b0cf3bf5f3b32113 (diff)
Fix parsing of square bracket characters in IMAP response strings (#1489223)
Diffstat (limited to 'tests/Framework/ImapGeneric.php')
-rw-r--r--tests/Framework/ImapGeneric.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Framework/ImapGeneric.php b/tests/Framework/ImapGeneric.php
index 2f9b6d10f..af73158e5 100644
--- a/tests/Framework/ImapGeneric.php
+++ b/tests/Framework/ImapGeneric.php
@@ -35,4 +35,27 @@ class Framework_ImapGeneric extends PHPUnit_Framework_TestCase
$this->assertSame(array(1, 2, 3), $result);
$this->assertCount(3, $result);
}
+
+ /**
+ * Test for tokenizeResponse
+ */
+ function test_tokenizeResponse()
+ {
+ $response = "test brack[et] {1}\r\na {0}\r\n (item1 item2)";
+
+ $result = rcube_imap_generic::tokenizeResponse($response, 1);
+ $this->assertSame("test", $result);
+
+ $result = rcube_imap_generic::tokenizeResponse($response, 1);
+ $this->assertSame("brack[et]", $result);
+
+ $result = rcube_imap_generic::tokenizeResponse($response, 1);
+ $this->assertSame("a", $result);
+
+ $result = rcube_imap_generic::tokenizeResponse($response, 1);
+ $this->assertSame("", $result);
+
+ $result = rcube_imap_generic::tokenizeResponse($response, 1);
+ $this->assertSame(array('item1', 'item2'), $result);
+ }
}