[Pkg-owncloud-commits] [php-sabre-vobject] 24/43: BirthdayCalendarGenerator now skips cards without FN
David Prévot
taffit at moszumanska.debian.org
Sat Sep 5 15:23:50 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 4.0.0-alpha2
in repository php-sabre-vobject.
commit 25711e09d667e11a4c668f080032dc5f507a2941
Author: Dominik Tobschall <dominik at fruux.com>
Date: Thu Jul 30 08:21:15 2015 +0200
BirthdayCalendarGenerator now skips cards without FN
---
lib/BirthdayCalendarGenerator.php | 5 +++++
tests/VObject/BirthdayCalendarGeneratorTest.php | 28 +++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/lib/BirthdayCalendarGenerator.php b/lib/BirthdayCalendarGenerator.php
index 8dc059b..8133fb2 100644
--- a/lib/BirthdayCalendarGenerator.php
+++ b/lib/BirthdayCalendarGenerator.php
@@ -136,6 +136,11 @@ class BirthdayCalendarGenerator {
continue;
}
+ // Skip if the card has no FN property.
+ if (!isset($object->FN)) {
+ continue;
+ }
+
// Set a year if it's not set.
$unknownYear = false;
diff --git a/tests/VObject/BirthdayCalendarGeneratorTest.php b/tests/VObject/BirthdayCalendarGeneratorTest.php
index be49bca..a28484a 100644
--- a/tests/VObject/BirthdayCalendarGeneratorTest.php
+++ b/tests/VObject/BirthdayCalendarGeneratorTest.php
@@ -478,4 +478,32 @@ VCF;
}
+ function testBrokenVcardWithoutFN() {
+
+ $generator = new BirthdayCalendarGenerator();
+ $input = <<<VCF
+BEGIN:VCARD
+VERSION:3.0
+N:Gump;Forrest;;Mr.
+BDAY:19850407
+UID:foo
+END:VCARD
+VCF;
+
+ $expected = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+END:VCALENDAR
+ICS;
+
+ $generator->setObjects($input);
+ $output = $generator->getResult();
+
+ $this->assertVObjEquals(
+ $expected,
+ $output
+ );
+
+ }
+
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list