summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-12-01 14:26:52 +0100
committerAleksander Machniak <alec@alec.pl>2014-12-01 14:26:52 +0100
commitf864495b7b7ab577e3aba5f06b34f92649de4a4b (patch)
treecd426af16fda5de577d31cc4a3899892928678ca /tests
parentcf7471eb8608740a02b8ef3d1ca4899096e028fc (diff)
Fix import of multiple contact email addresses from Outlook-csv format (#1490169)
Diffstat (limited to 'tests')
-rw-r--r--tests/Framework/Csv2vcard.php18
-rw-r--r--tests/src/Csv2vcard/outlook.csv2
-rw-r--r--tests/src/Csv2vcard/outlook.vcf7
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/Framework/Csv2vcard.php b/tests/Framework/Csv2vcard.php
index 4f48dfaa2..34faf7d8d 100644
--- a/tests/Framework/Csv2vcard.php
+++ b/tests/Framework/Csv2vcard.php
@@ -73,4 +73,22 @@ class Framework_Csv2vcard extends PHPUnit_Framework_TestCase
$this->assertEquals($vcf_text, $vcard);
}
+
+ function test_import_outlook()
+ {
+ $csv_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/outlook.csv');
+ $vcf_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/outlook.vcf');
+
+ $csv = new rcube_csv2vcard;
+ $csv->import($csv_text);
+ $result = $csv->export();
+ $vcard = $result[0]->export(false);
+
+ $this->assertCount(1, $result);
+
+ $vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
+ $vcard = trim(str_replace("\r\n", "\n", $vcard));
+
+ $this->assertEquals($vcf_text, $vcard);
+ }
}
diff --git a/tests/src/Csv2vcard/outlook.csv b/tests/src/Csv2vcard/outlook.csv
new file mode 100644
index 000000000..ffa082840
--- /dev/null
+++ b/tests/src/Csv2vcard/outlook.csv
@@ -0,0 +1,2 @@
+E-mail Address,E-mail 2 Address,E-mail 3 Address
+test1@domain.tld,test2@domain.tld,test3@domain.tld
diff --git a/tests/src/Csv2vcard/outlook.vcf b/tests/src/Csv2vcard/outlook.vcf
new file mode 100644
index 000000000..ffd7e0550
--- /dev/null
+++ b/tests/src/Csv2vcard/outlook.vcf
@@ -0,0 +1,7 @@
+BEGIN:VCARD
+VERSION:3.0
+FN:test1@domain.tld
+EMAIL;TYPE=INTERNET;TYPE=PREF:test1@domain.tld
+EMAIL;TYPE=INTERNET;TYPE=OTHER:test2@domain.tld
+EMAIL;TYPE=INTERNET;TYPE=OTHER:test3@domain.tld
+END:VCARD