[Pkg-owncloud-commits] [php-sabre-vobject] 328/341: Yay the first test _just works_ omg...
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:36:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit e0e84e0f1f8b628f74a322cd5d6077732425e61c
Author: Evert Pot <me at evertpot.com>
Date: Thu Jul 16 22:54:56 2015 -0400
Yay the first test _just works_ omg...
---
lib/FreeBusyGenerator.php | 7 +++---
tests/VObject/FreeBusyGeneratorTest.php | 43 +++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/lib/FreeBusyGenerator.php b/lib/FreeBusyGenerator.php
index 651746e..751d4a9 100644
--- a/lib/FreeBusyGenerator.php
+++ b/lib/FreeBusyGenerator.php
@@ -126,7 +126,7 @@ class FreeBusyGenerator {
* @param Document $vcalendar
* @return void
*/
- function setVAvailablility(Document $vcalendar) {
+ function setVAvailability(Document $vcalendar) {
$this->vavailability = $vcalendar;
@@ -235,8 +235,9 @@ class FreeBusyGenerator {
*/
protected function calculateAvailability(FreeBusyData $fbData, VCalendar $vavailability) {
- $vavailComps = usort(
- iterator_to_array($vavailability->VAVAILABILITY),
+ $vavailComps = iterator_to_array($vavailability->VAVAILABILITY);
+ usort(
+ $vavailComps,
function($a, $b) {
// We need to order the components by priority. Priority 1
diff --git a/tests/VObject/FreeBusyGeneratorTest.php b/tests/VObject/FreeBusyGeneratorTest.php
index 58803ed..51c9b94 100644
--- a/tests/VObject/FreeBusyGeneratorTest.php
+++ b/tests/VObject/FreeBusyGeneratorTest.php
@@ -58,6 +58,9 @@ class FreeBusyGeneratorTest extends TestCase {
);
if ($vavailability) {
+ if (is_string($vavailability)) {
+ $vavailability = Reader::read($vavailability);
+ }
$gen->setVAvailability($vavailability);
}
@@ -501,6 +504,46 @@ ICS;
$blob
);
+ }
+
+ /**
+ * This VAVAILABILITY object overlaps with the time-range, but we're just
+ * busy the entire time.
+ */
+ function testVAvailabilitySimple() {
+
+ $blob = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:lalala
+DTSTART:20110101T120000Z
+DTEND:20110101T130000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+ $vavail = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VAVAILABILITY
+DTSTART:20110101T000000Z
+DTEND:20120101T000000Z
+BEGIN:AVAILABLE
+DTSTART:20110101T000000Z
+DTEND:20110101T010000Z
+END:AVAILABLE
+END:VAVAILABILITY
+END:VCALENDAR
+ICS;
+
+ $this->assertFreeBusyReport(
+ "FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T110000Z/20110101T120000Z\n" .
+ "FREEBUSY:20110101T120000Z/20110101T130000Z\n" .
+ "FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T130000Z/20110103T110000Z",
+ $blob,
+ null,
+ $vavail
+ );
+
}
--
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