mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-08 23:59:28 +00:00
0bc0a09bf4
- application/extensions file system permission now is 775 - application/logs file system permission now is 775 - Added extensions directory in application/: config, controllers, helpers, hooks, libraries, models, views and widgets - Added view views/extensions/manage.php - Added controller controllers/system/extensions/Manager.php - Added library ExtensionsLib to manage extensions - Added model models/system/Extensions_model.php - Moved code related to print out info from MigrationLib to EPrintfLib
123 lines
3.8 KiB
PHP
123 lines
3.8 KiB
PHP
<?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));
|
|
|
|
}
|
|
|
|
}
|