[Pkg-owncloud-commits] [php-sabre-vobject] 04/43: Properly using params

David Prévot taffit at moszumanska.debian.org
Sat Sep 5 15:23:46 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 d67f9ab202fbe69dfaada21648f08e00a8e7c5b5
Author: Dominik Tobschall <dominik at fruux.com>
Date:   Wed Jul 8 14:08:53 2015 +0200

    Properly using params
---
 lib/BirthdayCalendarGenerator.php               | 11 ++++++++---
 tests/VObject/BirthdayCalendarGeneratorTest.php | 18 +++++++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/lib/BirthdayCalendarGenerator.php b/lib/BirthdayCalendarGenerator.php
index 8b6198c..dd65596 100644
--- a/lib/BirthdayCalendarGenerator.php
+++ b/lib/BirthdayCalendarGenerator.php
@@ -161,13 +161,18 @@ class BirthdayCalendarGenerator {
                 // It may make sense to add an info to our event that the year was unknown.
             }
 
-            // Generate the event.
-            $calendar->add('VEVENT', [
+            // Create event.
+            $event = $calendar->add('VEVENT', [
                 'SUMMARY'      => $object->FN->getValue() .'\'s Birthday',
                 'DTSTART'      => new \DateTime($object->BDAY->getValue(), $this->timeZone),
                 'RRULE'        => 'FREQ=YEARLY',
                 'TRANSP'       => 'TRANSPARENT',
-                'X-SABRE-BDAY' => [$object->UID->getValue(), 'BDAY', $object->FN->getValue()]
+            ]);
+
+            // Add X-SABRE-BDAY property.
+            $event->add('X-SABRE-BDAY', 'BDAY', [
+                'X-SABRE-VCARD-UID' => $object->UID->getValue(),
+                'X-SABRE-VCARD-FN'  => $object->FN->getValue(),
             ]);
 
         }
diff --git a/tests/VObject/BirthdayCalendarGeneratorTest.php b/tests/VObject/BirthdayCalendarGeneratorTest.php
index 13e6420..b612c3b 100644
--- a/tests/VObject/BirthdayCalendarGeneratorTest.php
+++ b/tests/VObject/BirthdayCalendarGeneratorTest.php
@@ -28,7 +28,7 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19850407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -75,14 +75,14 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19850407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 BEGIN:VEVENT
 SUMMARY:John Doe's Birthday
 DTSTART:19820210T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:bar,BDAY,John Doe
+X-SABRE-BDAY;X-SABRE-VCARD-UID=bar;X-SABRE-VCARD-FN=John Doe:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -119,7 +119,7 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19850407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -170,14 +170,14 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19850407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 BEGIN:VEVENT
 SUMMARY:John Doe's Birthday
 DTSTART:19820210T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:bar,BDAY,John Doe
+X-SABRE-BDAY;X-SABRE-VCARD-UID=bar;X-SABRE-VCARD-FN=John Doe:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -212,7 +212,7 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19000407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -247,7 +247,7 @@ SUMMARY:Forrest Gump's Birthday
 DTSTART:19000407T000000Z
 RRULE:FREQ=YEARLY
 TRANSP:TRANSPARENT
-X-SABRE-BDAY:foo,BDAY,Forrest Gump
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VEVENT
 END:VCALENDAR
 ICS;
@@ -270,7 +270,7 @@ VERSION:3.0
 N:Gump;Forrest;;Mr.
 FN:Forrest Gump
 BDAY:foo
-UID:foo
+X-SABRE-BDAY;X-SABRE-VCARD-UID=foo;X-SABRE-VCARD-FN=Forrest Gump:BDAY
 END:VCARD
 VCF;
 

-- 
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