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:06:10 +0200
commitb231c8f6accb7c04461ab8364016d0abbe81f82e (patch)
treedd31cbe0ae7d4e0dd30bfc93af6f2e790cfd26bf /tests/Framework/VCard.php
parent4cef8c7ec98d19a8dc29cd74a15e87e8995d0c3c (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()