summaryrefslogtreecommitdiff
path: root/tests/Framework/VCard.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-07-07 19:06:10 +0200
committerAleksander Machniak <alec@alec.pl>2014-07-07 19:07:04 +0200
commit118a170dbca9f55badb3f05abb231c1c98eb3539 (patch)
tree909d1b5e937bf73b1aed4fc161822957301a65b6 /tests/Framework/VCard.php
parent224278cc4dd0c53f8da4379305b0fe2458633e1b (diff)
Fix images import from various vCard formats (#1489977)
Diffstat (limited to 'tests/Framework/VCard.php')
-rw-r--r--tests/Framework/VCard.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Framework/VCard.php b/tests/Framework/VCard.php
index 3353b5b13..0a34fc51f 100644
--- a/tests/Framework/VCard.php
+++ b/tests/Framework/VCard.php
@@ -107,6 +107,22 @@ class Framework_VCard extends PHPUnit_Framework_TestCase
// ENCODING=b case (#1488683)
$this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
$this->assertEquals("Müller", $vcard['surname'], "Unicode characters");
+
+ $input = str_replace('ENCODING=b:', 'ENCODING=base64;jpeg:', $input);
+
+ $vcards = rcube_vcard::import($input);
+ $vcard = $vcards[0]->get_assoc();
+
+ // ENCODING=base64 case (#1489977)
+ $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
+
+ $input = str_replace('PHOTO;ENCODING=base64;jpeg:', 'PHOTO:data:image/jpeg;base64,', $input);
+
+ $vcards = rcube_vcard::import($input);
+ $vcard = $vcards[0]->get_assoc();
+
+ // vcard4.0 "PHOTO:data:image/jpeg;base64," case (#1489977)
+ $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
}
function test_encodings()