first commit
This commit is contained in:
32
vendor/johngrogg/ics-parser/tests/CleanCharacterTest.php
vendored
Normal file
32
vendor/johngrogg/ics-parser/tests/CleanCharacterTest.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use ICal\ICal;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CleanCharacterTest extends TestCase
|
||||
{
|
||||
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment
|
||||
|
||||
protected static function getMethod($name)
|
||||
{
|
||||
$class = new ReflectionClass(ICal::class);
|
||||
$method = $class->getMethod($name);
|
||||
|
||||
// < PHP 8.1.0
|
||||
$method->setAccessible(true);
|
||||
|
||||
return $method;
|
||||
}
|
||||
|
||||
public function testCleanCharacters()
|
||||
{
|
||||
$ical = new ICal();
|
||||
$input = 'Test with emoji 🔴👍🏻';
|
||||
|
||||
self::assertSame(
|
||||
self::getMethod('cleanCharacters')->invokeArgs($ical, array($input)),
|
||||
$input
|
||||
);
|
||||
}
|
||||
}
|
||||
24
vendor/johngrogg/ics-parser/tests/DynamicPropertiesTest.php
vendored
Normal file
24
vendor/johngrogg/ics-parser/tests/DynamicPropertiesTest.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use ICal\ICal;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DynamicPropertiesTest extends TestCase
|
||||
{
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment
|
||||
|
||||
public function testDynamicArraysAreSet()
|
||||
{
|
||||
$ical = new ICal('./tests/ical/ical-monthly.ics');
|
||||
|
||||
foreach ($ical->events() as $event) {
|
||||
$this->assertTrue(isset($event->dtstart_array));
|
||||
$this->assertTrue(isset($event->dtend_array));
|
||||
$this->assertTrue(isset($event->dtstamp_array));
|
||||
$this->assertTrue(isset($event->uid_array));
|
||||
$this->assertTrue(isset($event->created_array));
|
||||
$this->assertTrue(isset($event->last_modified_array));
|
||||
$this->assertTrue(isset($event->summary_array));
|
||||
}
|
||||
}
|
||||
}
|
||||
86
vendor/johngrogg/ics-parser/tests/KeyValueTest.php
vendored
Normal file
86
vendor/johngrogg/ics-parser/tests/KeyValueTest.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
use ICal\ICal;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class KeyValueTest extends TestCase
|
||||
{
|
||||
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment
|
||||
|
||||
public function testBoundaryCharactersInsideQuotes()
|
||||
{
|
||||
$checks = array(
|
||||
0 => 'ATTENDEE',
|
||||
1 => array(
|
||||
0 => 'mailto:julien@ag.com',
|
||||
1 => array(
|
||||
'PARTSTAT' => 'TENTATIVE',
|
||||
'CN' => 'ju: @ag.com = Ju ; ',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertLines(
|
||||
'ATTENDEE;PARTSTAT=TENTATIVE;CN="ju: @ag.com = Ju ; ":mailto:julien@ag.com',
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testUtf8Characters()
|
||||
{
|
||||
$checks = array(
|
||||
0 => 'ATTENDEE',
|
||||
1 => array(
|
||||
0 => 'mailto:juëǯ@ag.com',
|
||||
1 => array(
|
||||
'PARTSTAT' => 'TENTATIVE',
|
||||
'CN' => 'juëǯĻ',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertLines(
|
||||
'ATTENDEE;PARTSTAT=TENTATIVE;CN=juëǯĻ:mailto:juëǯ@ag.com',
|
||||
$checks
|
||||
);
|
||||
|
||||
$checks = array(
|
||||
0 => 'SUMMARY',
|
||||
1 => ' I love emojis 😀😁😁 ë, ǯ, Ļ',
|
||||
);
|
||||
|
||||
$this->assertLines(
|
||||
'SUMMARY: I love emojis 😀😁😁 ë, ǯ, Ļ',
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testParametersOfKeysWithMultipleValues()
|
||||
{
|
||||
$checks = array(
|
||||
0 => 'ATTENDEE',
|
||||
1 => array(
|
||||
0 => 'mailto:jsmith@example.com',
|
||||
1 => array(
|
||||
'DELEGATED-TO' => array(
|
||||
0 => 'mailto:jdoe@example.com',
|
||||
1 => 'mailto:jqpublic@example.com',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertLines(
|
||||
'ATTENDEE;DELEGATED-TO="mailto:jdoe@example.com","mailto:jqpublic@example.com":mailto:jsmith@example.com',
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
private function assertLines($lines, array $checks)
|
||||
{
|
||||
$ical = new ICal();
|
||||
|
||||
self::assertSame($ical->keyValueFromString($lines), $checks);
|
||||
}
|
||||
}
|
||||
580
vendor/johngrogg/ics-parser/tests/RecurrencesTest.php
vendored
Normal file
580
vendor/johngrogg/ics-parser/tests/RecurrencesTest.php
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
|
||||
use ICal\ICal;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RecurrencesTest extends TestCase
|
||||
{
|
||||
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment
|
||||
// phpcs:disable Squiz.Commenting.VariableComment
|
||||
|
||||
private $originalTimeZone = null;
|
||||
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
public function setUpFixtures()
|
||||
{
|
||||
$this->originalTimeZone = date_default_timezone_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @after
|
||||
*/
|
||||
public function tearDownFixtures()
|
||||
{
|
||||
date_default_timezone_set($this->originalTimeZone);
|
||||
}
|
||||
|
||||
public function testYearlyFullDayTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
array('index' => 1, 'dateString' => '20010301T000000', 'message' => '2nd event, CET: '),
|
||||
array('index' => 2, 'dateString' => '20020301T000000', 'message' => '3rd event, CET: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000302',
|
||||
'RRULE:FREQ=YEARLY;WKST=SU;COUNT=3',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testMonthlyFullDayTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
array('index' => 1, 'dateString' => '20000401T000000', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 2, 'dateString' => '20000501T000000', 'message' => '3rd event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000302',
|
||||
'RRULE:FREQ=MONTHLY;BYMONTHDAY=1;WKST=SU;COUNT=3',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testMonthlyFullDayTimeZoneBerlinSummerTime()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20180701', 'message' => '1st event, CEST: '),
|
||||
array('index' => 1, 'dateString' => '20180801T000000', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 2, 'dateString' => '20180901T000000', 'message' => '3rd event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;VALUE=DATE:20180701',
|
||||
'DTEND;VALUE=DATE:20180702',
|
||||
'RRULE:FREQ=MONTHLY;WKST=SU;COUNT=3',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testMonthlyFullDayTimeZoneBerlinFromFile()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20180701', 'message' => '1st event, CEST: '),
|
||||
array('index' => 1, 'dateString' => '20180801T000000', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 2, 'dateString' => '20180901T000000', 'message' => '3rd event, CEST: '),
|
||||
);
|
||||
$this->assertEventFile(
|
||||
'Europe/Berlin',
|
||||
'./tests/ical/ical-monthly.ics',
|
||||
25,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testIssue196FromFile()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20191105T190000', 'timezone' => 'Europe/Berlin', 'message' => '1st event, CEST: '),
|
||||
array('index' => 1, 'dateString' => '20191106T190000', 'timezone' => 'Europe/Berlin', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 2, 'dateString' => '20191107T190000', 'timezone' => 'Europe/Berlin', 'message' => '3rd event, CEST: '),
|
||||
array('index' => 3, 'dateString' => '20191108T190000', 'timezone' => 'Europe/Berlin', 'message' => '4th event, CEST: '),
|
||||
array('index' => 4, 'dateString' => '20191109T170000', 'timezone' => 'Europe/Berlin', 'message' => '5th event, CEST: '),
|
||||
array('index' => 5, 'dateString' => '20191110T180000', 'timezone' => 'Europe/Berlin', 'message' => '6th event, CEST: '),
|
||||
);
|
||||
$this->assertEventFile(
|
||||
'UTC',
|
||||
'./tests/ical/issue-196.ics',
|
||||
7,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testWeeklyFullDayTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
array('index' => 1, 'dateString' => '20000308T000000', 'message' => '2nd event, CET: '),
|
||||
array('index' => 2, 'dateString' => '20000315T000000', 'message' => '3rd event, CET: '),
|
||||
array('index' => 3, 'dateString' => '20000322T000000', 'message' => '4th event, CET: '),
|
||||
array('index' => 4, 'dateString' => '20000329T000000', 'message' => '5th event, CEST: '),
|
||||
array('index' => 5, 'dateString' => '20000405T000000', 'message' => '6th event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000302',
|
||||
'RRULE:FREQ=WEEKLY;WKST=SU;COUNT=6',
|
||||
),
|
||||
6,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testDailyFullDayTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
array('index' => 1, 'dateString' => '20000302T000000', 'message' => '2nd event, CET: '),
|
||||
array('index' => 30, 'dateString' => '20000331T000000', 'message' => '31st event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000302',
|
||||
'RRULE:FREQ=DAILY;WKST=SU;COUNT=31',
|
||||
),
|
||||
31,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testWeeklyFullDayTimeZoneBerlinLocal()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301T000000', 'message' => '1st event, CET: '),
|
||||
array('index' => 1, 'dateString' => '20000308T000000', 'message' => '2nd event, CET: '),
|
||||
array('index' => 2, 'dateString' => '20000315T000000', 'message' => '3rd event, CET: '),
|
||||
array('index' => 3, 'dateString' => '20000322T000000', 'message' => '4th event, CET: '),
|
||||
array('index' => 4, 'dateString' => '20000329T000000', 'message' => '5th event, CEST: '),
|
||||
array('index' => 5, 'dateString' => '20000405T000000', 'message' => '6th event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/Berlin:20000301T000000',
|
||||
'DTEND;TZID=Europe/Berlin:20000302T000000',
|
||||
'RRULE:FREQ=WEEKLY;WKST=SU;COUNT=6',
|
||||
),
|
||||
6,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testRFCDaily10NewYork()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '19970902T090000', 'timezone' => 'America/New_York', 'message' => '1st event, EDT: '),
|
||||
array('index' => 1, 'dateString' => '19970903T090000', 'timezone' => 'America/New_York', 'message' => '2nd event, EDT: '),
|
||||
array('index' => 9, 'dateString' => '19970911T090000', 'timezone' => 'America/New_York', 'message' => '10th event, EDT: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;TZID=America/New_York:19970902T090000',
|
||||
'RRULE:FREQ=DAILY;COUNT=10',
|
||||
),
|
||||
10,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testRFCDaily10Berlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '19970902T090000', 'timezone' => 'Europe/Berlin', 'message' => '1st event, CEST: '),
|
||||
array('index' => 1, 'dateString' => '19970903T090000', 'timezone' => 'Europe/Berlin', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 9, 'dateString' => '19970911T090000', 'timezone' => 'Europe/Berlin', 'message' => '10th event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/Berlin:19970902T090000',
|
||||
'RRULE:FREQ=DAILY;COUNT=10',
|
||||
),
|
||||
10,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testStartDateIsExdateUsingUntil()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20190918T095000', 'timezone' => 'Europe/London', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20191002T095000', 'timezone' => 'Europe/London', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20191016T095000', 'timezone' => 'Europe/London', 'message' => '3rd event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/London',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/London:20190911T095000',
|
||||
'RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20191027T235959Z;BYDAY=WE',
|
||||
'EXDATE;TZID=Europe/London:20191023T095000',
|
||||
'EXDATE;TZID=Europe/London:20191009T095000',
|
||||
'EXDATE;TZID=Europe/London:20190925T095000',
|
||||
'EXDATE;TZID=Europe/London:20190911T095000',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testStartDateIsExdateUsingCount()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20190918T095000', 'timezone' => 'Europe/London', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20191002T095000', 'timezone' => 'Europe/London', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20191016T095000', 'timezone' => 'Europe/London', 'message' => '3rd event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/London',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/London:20190911T095000',
|
||||
'RRULE:FREQ=WEEKLY;WKST=SU;COUNT=7;BYDAY=WE',
|
||||
'EXDATE;TZID=Europe/London:20191023T095000',
|
||||
'EXDATE;TZID=Europe/London:20191009T095000',
|
||||
'EXDATE;TZID=Europe/London:20190925T095000',
|
||||
'EXDATE;TZID=Europe/London:20190911T095000',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testCountWithExdate()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20200323T050000', 'timezone' => 'Europe/Paris', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20200324T050000', 'timezone' => 'Europe/Paris', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20200327T050000', 'timezone' => 'Europe/Paris', 'message' => '3rd event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/London',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/Paris:20200323T050000',
|
||||
'DTEND;TZID=Europe/Paris:20200323T070000',
|
||||
'RRULE:FREQ=DAILY;COUNT=5',
|
||||
'EXDATE;TZID=Europe/Paris:20200326T050000',
|
||||
'EXDATE;TZID=Europe/Paris:20200325T050000',
|
||||
'DTSTAMP:20200318T141057Z',
|
||||
),
|
||||
3,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testRFCDaily10BerlinFromNewYork()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '19970902T090000', 'timezone' => 'Europe/Berlin', 'message' => '1st event, CEST: '),
|
||||
array('index' => 1, 'dateString' => '19970903T090000', 'timezone' => 'Europe/Berlin', 'message' => '2nd event, CEST: '),
|
||||
array('index' => 9, 'dateString' => '19970911T090000', 'timezone' => 'Europe/Berlin', 'message' => '10th event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'America/New_York',
|
||||
array(
|
||||
'DTSTART;TZID=Europe/Berlin:19970902T090000',
|
||||
'RRULE:FREQ=DAILY;COUNT=10',
|
||||
),
|
||||
10,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testExdatesInDifferentTimezone()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20170503T190000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20170510T190000', 'message' => '2nd event: '),
|
||||
array('index' => 9, 'dateString' => '20170712T190000', 'message' => '10th event: '),
|
||||
array('index' => 19, 'dateString' => '20171004T190000', 'message' => '20th event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'America/Chicago',
|
||||
array(
|
||||
'DTSTART;TZID=America/Chicago:20170503T190000',
|
||||
'RRULE:FREQ=WEEKLY;BYDAY=WE;WKST=SU;UNTIL=20180101',
|
||||
'EXDATE:20170601T000000Z',
|
||||
'EXDATE:20170803T000000Z',
|
||||
'EXDATE:20170824T000000Z',
|
||||
'EXDATE:20171026T000000Z',
|
||||
'EXDATE:20171102T000000Z',
|
||||
'EXDATE:20171123T010000Z',
|
||||
'EXDATE:20171221T010000Z',
|
||||
),
|
||||
28,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testYearlyWithBySetPos()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '19970306T090000', 'message' => '1st occurrence: '),
|
||||
array('index' => 1, 'dateString' => '19970313T090000', 'message' => '2nd occurrence: '),
|
||||
array('index' => 2, 'dateString' => '19970325T090000', 'message' => '3rd occurrence: '),
|
||||
array('index' => 3, 'dateString' => '19980305T090000', 'message' => '4th occurrence: '),
|
||||
array('index' => 4, 'dateString' => '19980312T090000', 'message' => '5th occurrence: '),
|
||||
array('index' => 5, 'dateString' => '19980326T090000', 'message' => '6th occurrence: '),
|
||||
array('index' => 9, 'dateString' => '20000307T090000', 'message' => '10th occurrence: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'America/New_York',
|
||||
array(
|
||||
'DTSTART;TZID=America/New_York:19970306T090000',
|
||||
'RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=3;BYDAY=TU,TH;BYSETPOS=2,4,-2',
|
||||
),
|
||||
10,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testDailyWithByMonthDay()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000206T120000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20000211T120000', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20000216T120000', 'message' => '3rd event: '),
|
||||
array('index' => 4, 'dateString' => '20000226T120000', 'message' => '5th event, transition from February to March: '),
|
||||
array('index' => 5, 'dateString' => '20000301T120000', 'message' => '6th event, transition to March from February: '),
|
||||
array('index' => 11, 'dateString' => '20000331T120000', 'message' => '12th event, transition from March to April: '),
|
||||
array('index' => 12, 'dateString' => '20000401T120000', 'message' => '13th event, transition to April from March: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART:20000206T120000',
|
||||
'DTEND:20000206T130000',
|
||||
'RRULE:FREQ=DAILY;BYMONTHDAY=1,6,11,16,21,26,31;COUNT=16',
|
||||
),
|
||||
16,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testYearlyWithByMonthDay()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20001214T120000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20001221T120000', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20010107T120000', 'message' => '3rd event: '),
|
||||
array('index' => 3, 'dateString' => '20010114T120000', 'message' => '4th event: '),
|
||||
array('index' => 6, 'dateString' => '20010214T120000', 'message' => '7th event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART:20001214T120000',
|
||||
'DTEND:20001214T130000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTHDAY=7,14,21;COUNT=8',
|
||||
),
|
||||
8,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testYearlyWithByMonthDayAndByDay()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20001214T120000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20001221T120000', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20010607T120000', 'message' => '3rd event: '),
|
||||
array('index' => 3, 'dateString' => '20010614T120000', 'message' => '4th event: '),
|
||||
array('index' => 6, 'dateString' => '20020214T120000', 'message' => '7th event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART:20001214T120000',
|
||||
'DTEND:20001214T130000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTHDAY=7,14,21;BYDAY=TH;COUNT=8',
|
||||
),
|
||||
8,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testYearlyWithByMonthAndByMonthDay()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20001214T120000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20001221T120000', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20010607T120000', 'message' => '3rd event: '),
|
||||
array('index' => 3, 'dateString' => '20010614T120000', 'message' => '4th event: '),
|
||||
array('index' => 6, 'dateString' => '20011214T120000', 'message' => '7th event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
array(
|
||||
'DTSTART:20001214T120000',
|
||||
'DTEND:20001214T130000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTH=12,6;BYMONTHDAY=7,14,21;COUNT=8',
|
||||
),
|
||||
8,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testCountIsOne()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20211201T090000', 'message' => '1st and only expected event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'UTC',
|
||||
array(
|
||||
'DTSTART:20211201T090000',
|
||||
'DTEND:20211201T100000',
|
||||
'RRULE:FREQ=DAILY;COUNT=1',
|
||||
),
|
||||
1,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function test5thByDayOfMonth()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20200103T090000', 'message' => '1st event: '),
|
||||
array('index' => 1, 'dateString' => '20200129T090000', 'message' => '2nd event: '),
|
||||
array('index' => 2, 'dateString' => '20200429T090000', 'message' => '3rd event: '),
|
||||
array('index' => 3, 'dateString' => '20200501T090000', 'message' => '4th event: '),
|
||||
array('index' => 4, 'dateString' => '20200703T090000', 'message' => '5th event: '),
|
||||
array('index' => 5, 'dateString' => '20200729T090000', 'message' => '6th event: '),
|
||||
array('index' => 6, 'dateString' => '20200930T090000', 'message' => '7th event: '),
|
||||
array('index' => 7, 'dateString' => '20201002T090000', 'message' => '8th event: '),
|
||||
array('index' => 8, 'dateString' => '20201230T090000', 'message' => '9th event: '),
|
||||
array('index' => 9, 'dateString' => '20210101T090000', 'message' => '10th and last event: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'UTC',
|
||||
array(
|
||||
'DTSTART:20200103T090000',
|
||||
'DTEND:20200103T100000',
|
||||
'RRULE:FREQ=MONTHLY;BYDAY=5WE,-5FR;UNTIL=20210102T090000',
|
||||
),
|
||||
10,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function assertVEVENT($defaultTimezone, $veventParts, $count, $checks)
|
||||
{
|
||||
$options = $this->getOptions($defaultTimezone);
|
||||
|
||||
$testIcal = implode(PHP_EOL, $this->getIcalHeader());
|
||||
$testIcal .= PHP_EOL;
|
||||
$testIcal .= implode(PHP_EOL, $this->formatIcalEvent($veventParts));
|
||||
$testIcal .= PHP_EOL;
|
||||
$testIcal .= implode(PHP_EOL, $this->getIcalFooter());
|
||||
|
||||
$ical = new ICal(false, $options);
|
||||
$ical->initString($testIcal);
|
||||
|
||||
$events = $ical->events();
|
||||
|
||||
$this->assertCount($count, $events);
|
||||
|
||||
foreach ($checks as $check) {
|
||||
$this->assertEvent($events[$check['index']], $check['dateString'], $check['message'], isset($check['timezone']) ? $check['timezone'] : $defaultTimezone);
|
||||
}
|
||||
}
|
||||
|
||||
public function assertEventFile($defaultTimezone, $file, $count, $checks)
|
||||
{
|
||||
$options = $this->getOptions($defaultTimezone);
|
||||
|
||||
$ical = new ICal($file, $options);
|
||||
|
||||
$events = $ical->events();
|
||||
|
||||
$this->assertCount($count, $events);
|
||||
|
||||
$events = $ical->sortEventsWithOrder($events);
|
||||
|
||||
foreach ($checks as $check) {
|
||||
$this->assertEvent($events[$check['index']], $check['dateString'], $check['message'], isset($check['timezone']) ? $check['timezone'] : $defaultTimezone);
|
||||
}
|
||||
}
|
||||
|
||||
public function assertEvent($event, $expectedDateString, $message, $timeZone = null)
|
||||
{
|
||||
if (!is_null($timeZone)) {
|
||||
date_default_timezone_set($timeZone);
|
||||
}
|
||||
|
||||
$expectedTimeStamp = strtotime($expectedDateString);
|
||||
|
||||
$this->assertSame($expectedTimeStamp, $event->dtstart_array[2], $message . 'timestamp mismatch (expected ' . $expectedDateString . ' vs actual ' . $event->dtstart . ')');
|
||||
$this->assertSame($expectedDateString, $event->dtstart, $message . 'dtstart mismatch (timestamp is okay)');
|
||||
}
|
||||
|
||||
public function getOptions($defaultTimezone)
|
||||
{
|
||||
$options = array(
|
||||
'defaultSpan' => 2, // Default value
|
||||
'defaultTimeZone' => $defaultTimezone, // Default value: UTC
|
||||
'defaultWeekStart' => 'MO', // Default value
|
||||
'disableCharacterReplacement' => false, // Default value
|
||||
'filterDaysAfter' => null, // Default value
|
||||
'filterDaysBefore' => null, // Default value
|
||||
'httpUserAgent' => null, // Default value
|
||||
'skipRecurrence' => false, // Default value
|
||||
);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function formatIcalEvent($veventParts)
|
||||
{
|
||||
return array_merge(
|
||||
array(
|
||||
'BEGIN:VEVENT',
|
||||
'CREATED:' . gmdate('Ymd\THis\Z'),
|
||||
'UID:M2CD-1-1-5FB000FB-BBE4-4F3F-9E7E-217F1FF97209',
|
||||
),
|
||||
$veventParts,
|
||||
array(
|
||||
'SUMMARY:test',
|
||||
'LAST-MODIFIED:' . gmdate('Ymd\THis\Z', filemtime(__FILE__)),
|
||||
'END:VEVENT',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getIcalHeader()
|
||||
{
|
||||
return array(
|
||||
'BEGIN:VCALENDAR',
|
||||
'VERSION:2.0',
|
||||
'PRODID:-//Google Inc//Google Calendar 70.9054//EN',
|
||||
'X-WR-CALNAME:Private',
|
||||
'X-APPLE-CALENDAR-COLOR:#FF2968',
|
||||
'X-WR-CALDESC:',
|
||||
);
|
||||
}
|
||||
|
||||
public function getIcalFooter()
|
||||
{
|
||||
return array('END:VCALENDAR');
|
||||
}
|
||||
}
|
||||
1059
vendor/johngrogg/ics-parser/tests/Rfc5545RecurrenceTest.php
vendored
Normal file
1059
vendor/johngrogg/ics-parser/tests/Rfc5545RecurrenceTest.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
509
vendor/johngrogg/ics-parser/tests/SingleEventsTest.php
vendored
Normal file
509
vendor/johngrogg/ics-parser/tests/SingleEventsTest.php
vendored
Normal file
@@ -0,0 +1,509 @@
|
||||
<?php
|
||||
|
||||
use ICal\ICal;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SingleEventsTest extends TestCase
|
||||
{
|
||||
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment
|
||||
// phpcs:disable Squiz.Commenting.VariableComment
|
||||
|
||||
private $originalTimeZone = null;
|
||||
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
public function setUpFixtures()
|
||||
{
|
||||
$this->originalTimeZone = date_default_timezone_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @after
|
||||
*/
|
||||
public function tearDownFixtures()
|
||||
{
|
||||
date_default_timezone_set($this->originalTimeZone);
|
||||
}
|
||||
|
||||
public function testFullDayTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000302',
|
||||
1,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testSeveralFullDaysTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20000301', 'message' => '1st event, CET: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
'DTSTART;VALUE=DATE:20000301',
|
||||
'DTEND;VALUE=DATE:20000304',
|
||||
1,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testEventTimeZoneUTC()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20180626T070000Z', 'message' => '1st event, UTC: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
'DTSTART:20180626T070000Z',
|
||||
'DTEND:20180626T110000Z',
|
||||
1,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function testEventTimeZoneBerlin()
|
||||
{
|
||||
$checks = array(
|
||||
array('index' => 0, 'dateString' => '20180626T070000', 'message' => '1st event, CEST: '),
|
||||
);
|
||||
$this->assertVEVENT(
|
||||
'Europe/Berlin',
|
||||
'DTSTART:20180626T070000',
|
||||
'DTEND:20180626T110000',
|
||||
1,
|
||||
$checks
|
||||
);
|
||||
}
|
||||
|
||||
public function assertVEVENT($defaultTimezone, $dtstart, $dtend, $count, $checks)
|
||||
{
|
||||
$options = $this->getOptions($defaultTimezone);
|
||||
|
||||
$testIcal = implode(PHP_EOL, $this->getIcalHeader());
|
||||
$testIcal .= PHP_EOL;
|
||||
$testIcal .= implode(PHP_EOL, $this->formatIcalEvent($dtstart, $dtend));
|
||||
$testIcal .= PHP_EOL;
|
||||
$testIcal .= implode(PHP_EOL, $this->getIcalTimezones());
|
||||
$testIcal .= PHP_EOL;
|
||||
$testIcal .= implode(PHP_EOL, $this->getIcalFooter());
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$ical = new ICal(false, $options);
|
||||
$ical->initString($testIcal);
|
||||
|
||||
$events = $ical->events();
|
||||
|
||||
$this->assertCount($count, $events);
|
||||
|
||||
foreach ($checks as $check) {
|
||||
$this->assertEvent(
|
||||
$events[$check['index']],
|
||||
$check['dateString'],
|
||||
$check['message'],
|
||||
isset($check['timezone']) ? $check['timezone'] : $defaultTimezone
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getOptions($defaultTimezone)
|
||||
{
|
||||
$options = array(
|
||||
'defaultSpan' => 2, // Default value
|
||||
'defaultTimeZone' => $defaultTimezone, // Default value: UTC
|
||||
'defaultWeekStart' => 'MO', // Default value
|
||||
'disableCharacterReplacement' => false, // Default value
|
||||
'filterDaysAfter' => null, // Default value
|
||||
'filterDaysBefore' => null, // Default value
|
||||
'httpUserAgent' => null, // Default value
|
||||
'skipRecurrence' => false, // Default value
|
||||
);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function getIcalHeader()
|
||||
{
|
||||
return array(
|
||||
'BEGIN:VCALENDAR',
|
||||
'VERSION:2.0',
|
||||
'PRODID:-//Google Inc//Google Calendar 70.9054//EN',
|
||||
'X-WR-CALNAME:Private',
|
||||
'X-APPLE-CALENDAR-COLOR:#FF2968',
|
||||
'X-WR-CALDESC:',
|
||||
);
|
||||
}
|
||||
|
||||
public function formatIcalEvent($dtstart, $dtend)
|
||||
{
|
||||
return array(
|
||||
'BEGIN:VEVENT',
|
||||
'CREATED:20090213T195947Z',
|
||||
'UID:M2CD-1-1-5FB000FB-BBE4-4F3F-9E7E-217F1FF97209',
|
||||
$dtstart,
|
||||
$dtend,
|
||||
'SUMMARY:test',
|
||||
'DESCRIPTION;LANGUAGE=en-gb:This is a short description\nwith a new line. Some "special" \'s',
|
||||
' igns\' may be interesting\, too.',
|
||||
' And a non-breaking space.',
|
||||
'LAST-MODIFIED:20110429T222101Z',
|
||||
'DTSTAMP:20170630T105724Z',
|
||||
'SEQUENCE:0',
|
||||
'END:VEVENT',
|
||||
);
|
||||
}
|
||||
|
||||
public function getIcalTimezones()
|
||||
{
|
||||
return array(
|
||||
'BEGIN:VTIMEZONE',
|
||||
'TZID:Europe/Berlin',
|
||||
'X-LIC-LOCATION:Europe/Berlin',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:18930401T000000',
|
||||
'RDATE:18930401T000000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+005328',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19160430T230000',
|
||||
'RDATE:19160430T230000',
|
||||
'RDATE:19400401T020000',
|
||||
'RDATE:19430329T020000',
|
||||
'RDATE:19460414T020000',
|
||||
'RDATE:19470406T030000',
|
||||
'RDATE:19480418T020000',
|
||||
'RDATE:19490410T020000',
|
||||
'RDATE:19800406T020000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19161001T010000',
|
||||
'RDATE:19161001T010000',
|
||||
'RDATE:19421102T030000',
|
||||
'RDATE:19431004T030000',
|
||||
'RDATE:19441002T030000',
|
||||
'RDATE:19451118T030000',
|
||||
'RDATE:19461007T030000',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19170416T020000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19180415T010000Z;BYMONTH=4;BYDAY=3MO',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19170917T030000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19180916T010000Z;BYMONTH=9;BYDAY=3MO',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19440403T020000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19450402T010000Z;BYMONTH=4;BYDAY=1MO',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19450524T020000',
|
||||
'RDATE:19450524T020000',
|
||||
'RDATE:19470511T030000',
|
||||
'TZNAME:CEMT',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0300',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19450924T030000',
|
||||
'RDATE:19450924T030000',
|
||||
'RDATE:19470629T030000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0300',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19460101T000000',
|
||||
'RDATE:19460101T000000',
|
||||
'RDATE:19800101T000000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19471005T030000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19491002T010000Z;BYMONTH=10;BYDAY=1SU',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19800928T030000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19950924T010000Z;BYMONTH=9;BYDAY=-1SU',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19810329T020000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19961027T030000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'END:VTIMEZONE',
|
||||
'BEGIN:VTIMEZONE',
|
||||
'TZID:Europe/Paris',
|
||||
'X-LIC-LOCATION:Europe/Paris',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:18910315T000100',
|
||||
'RDATE:18910315T000100',
|
||||
'TZNAME:PMT',
|
||||
'TZOFFSETFROM:+000921',
|
||||
'TZOFFSETTO:+000921',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19110311T000100',
|
||||
'RDATE:19110311T000100',
|
||||
'TZNAME:WEST',
|
||||
'TZOFFSETFROM:+000921',
|
||||
'TZOFFSETTO:+0000',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19160614T230000',
|
||||
'RDATE:19160614T230000',
|
||||
'RDATE:19170324T230000',
|
||||
'RDATE:19180309T230000',
|
||||
'RDATE:19190301T230000',
|
||||
'RDATE:19200214T230000',
|
||||
'RDATE:19210314T230000',
|
||||
'RDATE:19220325T230000',
|
||||
'RDATE:19230526T230000',
|
||||
'RDATE:19240329T230000',
|
||||
'RDATE:19250404T230000',
|
||||
'RDATE:19260417T230000',
|
||||
'RDATE:19270409T230000',
|
||||
'RDATE:19280414T230000',
|
||||
'RDATE:19290420T230000',
|
||||
'RDATE:19300412T230000',
|
||||
'RDATE:19310418T230000',
|
||||
'RDATE:19320402T230000',
|
||||
'RDATE:19330325T230000',
|
||||
'RDATE:19340407T230000',
|
||||
'RDATE:19350330T230000',
|
||||
'RDATE:19360418T230000',
|
||||
'RDATE:19370403T230000',
|
||||
'RDATE:19380326T230000',
|
||||
'RDATE:19390415T230000',
|
||||
'RDATE:19400225T020000',
|
||||
'TZNAME:WEST',
|
||||
'TZOFFSETFROM:+0000',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19161002T000000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19191005T230000Z;BYMONTH=10;BYMONTHDAY=2,3,4,5,6,',
|
||||
' 7,8;BYDAY=MO',
|
||||
'TZNAME:WET',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0000',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19201024T000000',
|
||||
'RDATE:19201024T000000',
|
||||
'RDATE:19211026T000000',
|
||||
'RDATE:19391119T000000',
|
||||
'TZNAME:WET',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0000',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19221008T000000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19381001T230000Z;BYMONTH=10;BYMONTHDAY=2,3,4,5,6,',
|
||||
' 7,8;BYDAY=SU',
|
||||
'TZNAME:WET',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0000',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19400614T230000',
|
||||
'RDATE:19400614T230000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19421102T030000',
|
||||
'RDATE:19421102T030000',
|
||||
'RDATE:19431004T030000',
|
||||
'RDATE:19760926T010000',
|
||||
'RDATE:19770925T030000',
|
||||
'RDATE:19781001T030000',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19430329T020000',
|
||||
'RDATE:19430329T020000',
|
||||
'RDATE:19440403T020000',
|
||||
'RDATE:19760328T010000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19440825T000000',
|
||||
'RDATE:19440825T000000',
|
||||
'TZNAME:WEST',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19441008T010000',
|
||||
'RDATE:19441008T010000',
|
||||
'TZNAME:WEST',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19450402T020000',
|
||||
'RDATE:19450402T020000',
|
||||
'TZNAME:WEMT',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19450916T030000',
|
||||
'RDATE:19450916T030000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19770101T000000',
|
||||
'RDATE:19770101T000000',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19770403T020000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19800406T010000Z;BYMONTH=4;BYDAY=1SU',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19790930T030000',
|
||||
'RRULE:FREQ=YEARLY;UNTIL=19950924T010000Z;BYMONTH=9;BYDAY=-1SU',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19810329T020000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU',
|
||||
'TZNAME:CEST',
|
||||
'TZOFFSETFROM:+0100',
|
||||
'TZOFFSETTO:+0200',
|
||||
'END:DAYLIGHT',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19961027T030000',
|
||||
'RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU',
|
||||
'TZNAME:CET',
|
||||
'TZOFFSETFROM:+0200',
|
||||
'TZOFFSETTO:+0100',
|
||||
'END:STANDARD',
|
||||
'END:VTIMEZONE',
|
||||
'BEGIN:VTIMEZONE',
|
||||
'TZID:US-Eastern',
|
||||
'LAST-MODIFIED:19870101T000000Z',
|
||||
'TZURL:http://zones.stds_r_us.net/tz/US-Eastern',
|
||||
'BEGIN:STANDARD',
|
||||
'DTSTART:19671029T020000',
|
||||
'RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10',
|
||||
'TZOFFSETFROM:-0400',
|
||||
'TZOFFSETTO:-0500',
|
||||
'TZNAME:EST',
|
||||
'END:STANDARD',
|
||||
'BEGIN:DAYLIGHT',
|
||||
'DTSTART:19870405T020000',
|
||||
'RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4',
|
||||
'TZOFFSETFROM:-0500',
|
||||
'TZOFFSETTO:-0400',
|
||||
'TZNAME:EDT',
|
||||
'END:DAYLIGHT',
|
||||
'END:VTIMEZONE',
|
||||
);
|
||||
}
|
||||
|
||||
public function getIcalFooter()
|
||||
{
|
||||
return array('END:VCALENDAR');
|
||||
}
|
||||
|
||||
public function assertEvent($event, $expectedDateString, $message, $timezone = null)
|
||||
{
|
||||
if ($timezone !== null) {
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
$expectedTimeStamp = strtotime($expectedDateString);
|
||||
|
||||
$this->assertSame(
|
||||
$expectedTimeStamp,
|
||||
$event->dtstart_array[2],
|
||||
$message . 'timestamp mismatch (expected ' . $expectedDateString . ' vs actual ' . $event->dtstart . ')'
|
||||
);
|
||||
$this->assertSame(
|
||||
$expectedDateString,
|
||||
$event->dtstart,
|
||||
$message . 'dtstart mismatch (timestamp is okay)'
|
||||
);
|
||||
}
|
||||
|
||||
public function assertEventFile($defaultTimezone, $file, $count, $checks)
|
||||
{
|
||||
$options = $this->getOptions($defaultTimezone);
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
$ical = new ICal($file, $options);
|
||||
|
||||
$events = $ical->events();
|
||||
|
||||
$this->assertCount($count, $events);
|
||||
|
||||
foreach ($checks as $check) {
|
||||
$this->assertEvent(
|
||||
$events[$check['index']],
|
||||
$check['dateString'],
|
||||
$check['message'],
|
||||
isset($check['timezone']) ? $check['timezone'] : $defaultTimezone
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
vendor/johngrogg/ics-parser/tests/ical/ical-monthly.ics
vendored
Normal file
18
vendor/johngrogg/ics-parser/tests/ical/ical-monthly.ics
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
|
||||
VERSION:2.0
|
||||
X-WR-CALNAME:Private
|
||||
X-APPLE-CALENDAR-COLOR:#FF2968
|
||||
X-WR-CALDESC:
|
||||
BEGIN:VEVENT
|
||||
CREATED:20090213T195947Z
|
||||
UID:M2CD-1-1-5FB000FB-BBE4-4F3F-9E7E-217F1FF97208
|
||||
RRULE:FREQ=MONTHLY;BYMONTHDAY=1;WKST=SU;COUNT=25
|
||||
DTSTART;VALUE=DATE:20180701
|
||||
DTEND;VALUE=DATE:20180702
|
||||
SUMMARY:Monthly
|
||||
LAST-MODIFIED:20110429T222101Z
|
||||
DTSTAMP:20170630T105724Z
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
64
vendor/johngrogg/ics-parser/tests/ical/issue-196.ics
vendored
Normal file
64
vendor/johngrogg/ics-parser/tests/ical/issue-196.ics
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
|
||||
VERSION:2.0
|
||||
X-WR-CALNAME:Test-Calendar
|
||||
X-WR-TIMEZONE:Europe/Berlin
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Europe/Berlin
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:+0100
|
||||
TZOFFSETTO:+0200
|
||||
TZNAME:CEST
|
||||
DTSTART:19700329T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:+0200
|
||||
TZOFFSETTO:+0100
|
||||
TZNAME:CET
|
||||
DTSTART:19701025T030000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
CREATED:20180101T152047Z
|
||||
LAST-MODIFIED:20181202T202056Z
|
||||
DTSTAMP:20181202T202056Z
|
||||
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
|
||||
SUMMARY:test
|
||||
RRULE:FREQ=DAILY;UNTIL=20191111T180000Z
|
||||
DTSTART;TZID=Europe/Berlin:20191105T190000
|
||||
DTEND;TZID=Europe/Berlin:20191105T220000
|
||||
TRANSP:OPAQUE
|
||||
SEQUENCE:24
|
||||
X-MOZ-GENERATION:37
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
CREATED:20181202T202042Z
|
||||
LAST-MODIFIED:20181202T202053Z
|
||||
DTSTAMP:20181202T202053Z
|
||||
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
|
||||
SUMMARY:test
|
||||
RECURRENCE-ID;TZID=Europe/Berlin:20191109T190000
|
||||
DTSTART;TZID=Europe/Berlin:20191109T170000
|
||||
DTEND;TZID=Europe/Berlin:20191109T220000
|
||||
TRANSP:OPAQUE
|
||||
SEQUENCE:25
|
||||
X-MOZ-GENERATION:37
|
||||
DURATION:PT0S
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
CREATED:20181202T202053Z
|
||||
LAST-MODIFIED:20181202T202056Z
|
||||
DTSTAMP:20181202T202056Z
|
||||
UID:529b1ea3-8de8-484d-b878-c20c7fb72bf5
|
||||
SUMMARY:test
|
||||
RECURRENCE-ID;TZID=Europe/Berlin:20191110T190000
|
||||
DTSTART;TZID=Europe/Berlin:20191110T180000
|
||||
DTEND;TZID=Europe/Berlin:20191110T220000
|
||||
TRANSP:OPAQUE
|
||||
SEQUENCE:25
|
||||
X-MOZ-GENERATION:37
|
||||
DURATION:PT0S
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
Reference in New Issue
Block a user