diff options
author | Paolo T <tuscanhobbit@users.noreply.github.com> | 2013-10-25 00:09:42 -0700 |
---|---|---|
committer | Paolo T <tuscanhobbit@users.noreply.github.com> | 2013-10-25 00:09:42 -0700 |
commit | b23f3fc03b6bc751aab67fe2258a21f7c65bab8e (patch) | |
tree | 84c997aa781afa566536ca5f66eb8f90ef468476 /vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php | |
parent | d30f718e0836a031e43d5403480aa049561e736e (diff) | |
parent | 0b0bd3c20765d267ec6d7cc261c7713917a22582 (diff) | |
download | volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.gz volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.tar.bz2 volse-hubzilla-b23f3fc03b6bc751aab67fe2258a21f7c65bab8e.zip |
Merge pull request #3 from friendica/master
Align to main project HEAD
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php new file mode 100644 index 000000000..9de24d3aa --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/CalDAV/CalendarQueryVAlarmTest.php @@ -0,0 +1,122 @@ +<?php + +namespace Sabre\CalDAV; + +use Sabre\VObject; + +class CalendarQueryVAlarmTest extends \PHPUnit_Framework_TestCase { + + /** + * This test is specifically for a time-range query on a VALARM, contained + * in a VEVENT that's recurring + */ + function testValarm() { + + $vcalendar = new VObject\Component\VCalendar(); + + $vevent = $vcalendar->createComponent('VEVENT'); + $vevent->RRULE = 'FREQ=MONTHLY'; + $vevent->DTSTART = '20120101T120000Z'; + $vevent->UID = 'bla'; + + $valarm = $vcalendar->createComponent('VALARM'); + $valarm->TRIGGER = '-P15D'; + $vevent->add($valarm); + + + $vcalendar->add($vevent); + + $filter = array( + 'name' => 'VCALENDAR', + 'is-not-defined' => false, + 'time-range' => null, + 'prop-filters' => array(), + 'comp-filters' => array( + array( + 'name' => 'VEVENT', + 'is-not-defined' => false, + 'time-range' => null, + 'prop-filters' => array(), + 'comp-filters' => array( + array( + 'name' => 'VALARM', + 'is-not-defined' => false, + 'prop-filters' => array(), + 'comp-filters' => array(), + 'time-range' => array( + 'start' => new \DateTime('2012-05-10'), + 'end' => new \DateTime('2012-05-20'), + ), + ), + ), + ), + ), + ); + + $validator = new CalendarQueryValidator(); + $this->assertTrue($validator->validate($vcalendar, $filter)); + + $vcalendar = new VObject\Component\VCalendar(); + + // A limited recurrence rule, should return false + $vevent = $vcalendar->createComponent('VEVENT'); + $vevent->RRULE = 'FREQ=MONTHLY;COUNT=1'; + $vevent->DTSTART = '20120101T120000Z'; + $vevent->UID = 'bla'; + + $valarm = $vcalendar->createComponent('VALARM'); + $valarm->TRIGGER = '-P15D'; + $vevent->add($valarm); + + $vcalendar->add($vevent); + + $this->assertFalse($validator->validate($vcalendar, $filter)); + } + + function testAlarmWayBefore() { + + $vcalendar = new VObject\Component\VCalendar(); + + $vevent = $vcalendar->createComponent('VEVENT'); + $vevent->DTSTART = '20120101T120000Z'; + $vevent->UID = 'bla'; + + $valarm = $vcalendar->createComponent('VALARM'); + $valarm->TRIGGER = '-P2W1D'; + $vevent->add($valarm); + + $vcalendar->add($vevent); + + $filter = array( + 'name' => 'VCALENDAR', + 'is-not-defined' => false, + 'time-range' => null, + 'prop-filters' => array(), + 'comp-filters' => array( + array( + 'name' => 'VEVENT', + 'is-not-defined' => false, + 'time-range' => null, + 'prop-filters' => array(), + 'comp-filters' => array( + array( + 'name' => 'VALARM', + 'is-not-defined' => false, + 'prop-filters' => array(), + 'comp-filters' => array(), + 'time-range' => array( + 'start' => new \DateTime('2011-12-10'), + 'end' => new \DateTime('2011-12-20'), + ), + ), + ), + ), + ), + ); + + $validator = new CalendarQueryValidator(); + $this->assertTrue($validator->validate($vcalendar, $filter)); + + } + +} |