ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\DateTimeParserTest Class Reference
+ Inheritance diagram for Sabre\VObject\DateTimeParserTest:
+ Collaboration diagram for Sabre\VObject\DateTimeParserTest:

Public Member Functions

 testParseICalendarDuration ()
 
 testParseICalendarDurationDateInterval ()
 
 testParseICalendarDurationFail ()
 
 testParseICalendarDateTime ()
 
 testParseICalendarDateTimeBadFormat ()
 testParseICalendarDateTime More...
 
 testParseICalendarDateTimeInvalidTime ()
 testParseICalendarDateTime More...
 
 testParseICalendarDateTimeUTC ()
 testParseICalendarDateTime More...
 
 testParseICalendarDateTimeUTC2 ()
 testParseICalendarDateTime More...
 
 testParseICalendarDateTimeCustomTimeZone ()
 testParseICalendarDateTime More...
 
 testParseICalendarDate ()
 
 testParseICalendarDateGreaterThan4000 ()
 TCheck if a date with year > 4000 will not throw an exception. More...
 
 testParseICalendarDateTimeGreaterThan4000 ()
 Check if a datetime with year > 4000 will not throw an exception. More...
 
 testParseICalendarDateBadFormat ()
 testParseICalendarDate More...
 
 testParseICalendarDateInvalidDate ()
 testParseICalendarDate More...
 
 testVCardDate ($input, $output)
 vcardDates More...
 
 testBadVCardDate ()
 
 testBadVCardTime ()
 
 vcardDates ()
 
 testDateAndOrTime_DateWithYearMonthDay ()
 
 testDateAndOrTime_DateWithYearMonth ()
 
 testDateAndOrTime_DateWithMonth ()
 
 testDateAndOrTime_DateWithMonthDay ()
 
 testDateAndOrTime_DateWithDay ()
 
 testDateAndOrTime_TimeWithHour ()
 
 testDateAndOrTime_TimeWithHourMinute ()
 
 testDateAndOrTime_TimeWithHourSecond ()
 
 testDateAndOrTime_TimeWithMinute ()
 
 testDateAndOrTime_TimeWithMinuteSecond ()
 
 testDateAndOrTime_TimeWithSecond ()
 
 testDateAndOrTime_TimeWithSecondZ ()
 
 testDateAndOrTime_TimeWithSecondTZ ()
 
 testDateAndOrTime_DateTimeWithYearMonthDayHour ()
 
 testDateAndOrTime_DateTimeWithMonthDayHour ()
 
 testDateAndOrTime_DateTimeWithDayHour ()
 
 testDateAndOrTime_DateTimeWithDayHourMinute ()
 
 testDateAndOrTime_DateTimeWithDayHourMinuteSecond ()
 
 testDateAndOrTime_DateTimeWithDayHourZ ()
 
 testDateAndOrTime_DateTimeWithDayHourTZ ()
 

Protected Member Functions

 assertDateAndOrTimeEqualsTo ($date, $parts)
 

Detailed Description

Definition at line 10 of file DateTimeParserTest.php.

Member Function Documentation

◆ assertDateAndOrTimeEqualsTo()

Sabre\VObject\DateTimeParserTest::assertDateAndOrTimeEqualsTo (   $date,
  $parts 
)
protected

Definition at line 680 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseVCardDateAndOrTime().

Referenced by Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithDayHour(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithDayHourMinute(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithDayHourMinuteSecond(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithDayHourTZ(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithDayHourZ(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithMonthDayHour(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateTimeWithYearMonthDayHour(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateWithDay(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateWithMonth(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateWithMonthDay(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateWithYearMonth(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_DateWithYearMonthDay(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithHour(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithHourMinute(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithHourSecond(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithMinute(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithMinuteSecond(), Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithSecondTZ(), and Sabre\VObject\DateTimeParserTest\testDateAndOrTime_TimeWithSecondZ().

680  {
681 
682  $this->assertSame(
684  array_merge(
685  [
686  'year' => null,
687  'month' => null,
688  'date' => null,
689  'hour' => null,
690  'minute' => null,
691  'second' => null,
692  'timezone' => null
693  ],
694  $parts
695  )
696  );
697 
698  }
static parseVCardDateAndOrTime($date)
This method parses a vCard date and or time value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testBadVCardDate()

Sabre\VObject\DateTimeParserTest::testBadVCardDate ( )

Definition at line 191 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseVCardDateTime().

191  {
192 
194 
195  }
static parseVCardDateTime($date)
This method parses a vCard date and or time value.
+ Here is the call graph for this function:

◆ testBadVCardTime()

Sabre\VObject\DateTimeParserTest::testBadVCardTime ( )

Definition at line 200 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseVCardTime().

200  {
201 
202  DateTimeParser::parseVCardTime('23:12:166');
203 
204  }
static parseVCardTime($date)
This method parses a vCard TIME value.
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithDayHour()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithDayHour ( )

Definition at line 615 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

615  {
616 
618  '---28T13',
619  [
620  'date' => '28',
621  'hour' => '13'
622  ]
623  );
624 
625  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithDayHourMinute()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithDayHourMinute ( )

Definition at line 627 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

627  {
628 
630  '---28T1353',
631  [
632  'date' => '28',
633  'hour' => '13',
634  'minute' => '53'
635  ]
636  );
637 
638  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithDayHourMinuteSecond()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithDayHourMinuteSecond ( )

Definition at line 640 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

640  {
641 
643  '---28T135301',
644  [
645  'date' => '28',
646  'hour' => '13',
647  'minute' => '53',
648  'second' => '01'
649  ]
650  );
651 
652  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithDayHourTZ()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithDayHourTZ ( )

Definition at line 667 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

667  {
668 
670  '---28T13+1234',
671  [
672  'date' => '28',
673  'hour' => '13',
674  'timezone' => '+1234'
675  ]
676  );
677 
678  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithDayHourZ()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithDayHourZ ( )

Definition at line 654 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

654  {
655 
657  '---28T13Z',
658  [
659  'date' => '28',
660  'hour' => '13',
661  'timezone' => 'Z'
662  ]
663  );
664 
665  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithMonthDayHour()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithMonthDayHour ( )

Definition at line 602 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

602  {
603 
605  '--0128T13',
606  [
607  'month' => '01',
608  'date' => '28',
609  'hour' => '13'
610  ]
611  );
612 
613  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateTimeWithYearMonthDayHour()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateTimeWithYearMonthDayHour ( )

Definition at line 588 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

588  {
589 
591  '20150128T13',
592  [
593  'year' => '2015',
594  'month' => '01',
595  'date' => '28',
596  'hour' => '13'
597  ]
598  );
599 
600  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateWithDay()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateWithDay ( )

Definition at line 483 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

483  {
484 
486  '---28',
487  [
488  'date' => '28'
489  ]
490  );
491 
492  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateWithMonth()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateWithMonth ( )

Definition at line 460 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

460  {
461 
463  '--01',
464  [
465  'month' => '01'
466  ]
467  );
468 
469  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateWithMonthDay()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateWithMonthDay ( )

Definition at line 471 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

471  {
472 
474  '--0128',
475  [
476  'month' => '01',
477  'date' => '28'
478  ]
479  );
480 
481  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateWithYearMonth()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateWithYearMonth ( )

Definition at line 448 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

448  {
449 
451  '2015-01',
452  [
453  'year' => '2015',
454  'month' => '01'
455  ]
456  );
457 
458  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_DateWithYearMonthDay()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_DateWithYearMonthDay ( )

Definition at line 435 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

435  {
436 
438  '20150128',
439  [
440  'year' => '2015',
441  'month' => '01',
442  'date' => '28'
443  ]
444  );
445 
446  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithHour()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithHour ( )

Definition at line 494 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

494  {
495 
497  '13',
498  [
499  'hour' => '13'
500  ]
501  );
502 
503  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithHourMinute()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithHourMinute ( )

Definition at line 505 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

505  {
506 
508  '1353',
509  [
510  'hour' => '13',
511  'minute' => '53'
512  ]
513  );
514 
515  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithHourSecond()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithHourSecond ( )

Definition at line 517 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

517  {
518 
520  '135301',
521  [
522  'hour' => '13',
523  'minute' => '53',
524  'second' => '01'
525  ]
526 
527  );
528 
529  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithMinute()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithMinute ( )

Definition at line 531 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

531  {
532 
534  '-53',
535  [
536  'minute' => '53'
537  ]
538  );
539 
540  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithMinuteSecond()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithMinuteSecond ( )

Definition at line 542 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

542  {
543 
545  '-5301',
546  [
547  'minute' => '53',
548  'second' => '01'
549  ]
550  );
551 
552  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithSecond()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithSecond ( )

This is unreachable due to a conflict between date and time pattern. This is an error in the specification, not in our implementation.

Definition at line 554 of file DateTimeParserTest.php.

554  {
555 
556  $this->assertTrue(true);
557 
562  }

◆ testDateAndOrTime_TimeWithSecondTZ()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithSecondTZ ( )

Definition at line 576 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

576  {
577 
579  '--01+1234',
580  [
581  'second' => '01',
582  'timezone' => '+1234'
583  ]
584  );
585 
586  }
+ Here is the call graph for this function:

◆ testDateAndOrTime_TimeWithSecondZ()

Sabre\VObject\DateTimeParserTest::testDateAndOrTime_TimeWithSecondZ ( )

Definition at line 564 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParserTest\assertDateAndOrTimeEqualsTo().

564  {
565 
567  '--01Z',
568  [
569  'second' => '01',
570  'timezone' => 'Z'
571  ]
572  );
573 
574  }
+ Here is the call graph for this function:

◆ testParseICalendarDate()

Sabre\VObject\DateTimeParserTest::testParseICalendarDate ( )

Definition at line 111 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parse(), and Sabre\VObject\DateTimeParser\parseDate().

111  {
112 
113  $dateTime = DateTimeParser::parseDate('20100316');
114 
115  $expected = new DateTimeImmutable('2010-03-16 00:00:00', new DateTimeZone('UTC'));
116 
117  $this->assertEquals($expected, $dateTime);
118 
119  $dateTime = DateTimeParser::parse('20100316');
120  $this->assertEquals($expected, $dateTime);
121 
122  }
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
static parseDate($date, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateBadFormat()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateBadFormat ( )

testParseICalendarDate

Definition at line 160 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDate().

160  {
161 
162  $dateTime = DateTimeParser::parseDate('20100316T141405');
163 
164  }
static parseDate($date, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateGreaterThan4000()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateGreaterThan4000 ( )

TCheck if a date with year > 4000 will not throw an exception.

iOS seems to use 45001231 in yearly recurring events

Definition at line 127 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parse(), and Sabre\VObject\DateTimeParser\parseDate().

127  {
128 
129  $dateTime = DateTimeParser::parseDate('45001231');
130 
131  $expected = new DateTimeImmutable('4500-12-31 00:00:00', new DateTimeZone('UTC'));
132 
133  $this->assertEquals($expected, $dateTime);
134 
135  $dateTime = DateTimeParser::parse('45001231');
136  $this->assertEquals($expected, $dateTime);
137 
138  }
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
static parseDate($date, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateInvalidDate()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateInvalidDate ( )

testParseICalendarDate

Definition at line 170 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDate().

170  {
171 
172  $dateTime = DateTimeParser::parseDate('20101331');
173 
174  }
static parseDate($date, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted date and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTime()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTime ( )

Definition at line 45 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

45  {
46 
47  $dateTime = DateTimeParser::parseDateTime('20100316T141405');
48 
49  $compare = new DateTimeImmutable('2010-03-16 14:14:05', new DateTimeZone('UTC'));
50 
51  $this->assertEquals($compare, $dateTime);
52 
53  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeBadFormat()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeBadFormat ( )

testParseICalendarDateTime

Definition at line 59 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

59  {
60 
61  $dateTime = DateTimeParser::parseDateTime('20100316T141405 ');
62 
63  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeCustomTimeZone()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeCustomTimeZone ( )

testParseICalendarDateTime

Definition at line 102 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

102  {
103 
104  $dateTime = DateTimeParser::parseDateTime('20100316T141405', new DateTimeZone('Europe/Amsterdam'));
105 
106  $compare = new DateTimeImmutable('2010-03-16 14:14:05', new DateTimeZone('Europe/Amsterdam'));
107  $this->assertEquals($compare, $dateTime);
108 
109  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeGreaterThan4000()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeGreaterThan4000 ( )

Check if a datetime with year > 4000 will not throw an exception.

iOS seems to use 45001231T235959 in yearly recurring events

Definition at line 143 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parse(), and Sabre\VObject\DateTimeParser\parseDateTime().

143  {
144 
145  $dateTime = DateTimeParser::parseDateTime('45001231T235959');
146 
147  $expected = new DateTimeImmutable('4500-12-31 23:59:59', new DateTimeZone('UTC'));
148 
149  $this->assertEquals($expected, $dateTime);
150 
151  $dateTime = DateTimeParser::parse('45001231T235959');
152  $this->assertEquals($expected, $dateTime);
153 
154  }
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeInvalidTime()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeInvalidTime ( )

testParseICalendarDateTime

Definition at line 69 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

69  {
70 
71  $dateTime = DateTimeParser::parseDateTime('20100316T251405');
72 
73  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeUTC()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeUTC ( )

testParseICalendarDateTime

Definition at line 78 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

78  {
79 
80  $dateTime = DateTimeParser::parseDateTime('20100316T141405Z');
81 
82  $compare = new DateTimeImmutable('2010-03-16 14:14:05', new DateTimeZone('UTC'));
83  $this->assertEquals($compare, $dateTime);
84 
85  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDateTimeUTC2()

Sabre\VObject\DateTimeParserTest::testParseICalendarDateTimeUTC2 ( )

testParseICalendarDateTime

Definition at line 90 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDateTime().

90  {
91 
92  $dateTime = DateTimeParser::parseDateTime('20101211T160000Z');
93 
94  $compare = new DateTimeImmutable('2010-12-11 16:00:00', new DateTimeZone('UTC'));
95  $this->assertEquals($compare, $dateTime);
96 
97  }
static parseDateTime($dt, DateTimeZone $tz=null)
Parses an iCalendar (rfc5545) formatted datetime and returns a DateTimeImmutable object.
+ Here is the call graph for this function:

◆ testParseICalendarDuration()

Sabre\VObject\DateTimeParserTest::testParseICalendarDuration ( )

Definition at line 12 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDuration().

12  {
13 
14  $this->assertEquals('+1 weeks', DateTimeParser::parseDuration('P1W', true));
15  $this->assertEquals('+5 days', DateTimeParser::parseDuration('P5D', true));
16  $this->assertEquals('+5 days 3 hours 50 minutes 12 seconds', DateTimeParser::parseDuration('P5DT3H50M12S', true));
17  $this->assertEquals('-1 weeks 50 minutes', DateTimeParser::parseDuration('-P1WT50M', true));
18  $this->assertEquals('+50 days 3 hours 2 seconds', DateTimeParser::parseDuration('+P50DT3H2S', true));
19  $this->assertEquals('+0 seconds', DateTimeParser::parseDuration('+PT0S', true));
20  $this->assertEquals(new DateInterval('PT0S'), DateTimeParser::parseDuration('PT0S'));
21 
22  }
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
+ Here is the call graph for this function:

◆ testParseICalendarDurationDateInterval()

Sabre\VObject\DateTimeParserTest::testParseICalendarDurationDateInterval ( )

Definition at line 24 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parse(), and Sabre\VObject\DateTimeParser\parseDuration().

24  {
25 
26  $expected = new DateInterval('P7D');
27  $this->assertEquals($expected, DateTimeParser::parseDuration('P1W'));
28  $this->assertEquals($expected, DateTimeParser::parse('P1W'));
29 
30  $expected = new DateInterval('PT3M');
31  $expected->invert = true;
32  $this->assertEquals($expected, DateTimeParser::parseDuration('-PT3M'));
33 
34  }
static parse($date, $referenceTz=null)
Parses either a Date or DateTime, or Duration value.
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
+ Here is the call graph for this function:

◆ testParseICalendarDurationFail()

Sabre\VObject\DateTimeParserTest::testParseICalendarDurationFail ( )

Definition at line 39 of file DateTimeParserTest.php.

References Sabre\VObject\DateTimeParser\parseDuration().

39  {
40 
41  DateTimeParser::parseDuration('P1X', true);
42 
43  }
static parseDuration($duration, $asString=false)
Parses an iCalendar (RFC5545) formatted duration value.
+ Here is the call graph for this function:

◆ testVCardDate()

Sabre\VObject\DateTimeParserTest::testVCardDate (   $input,
  $output 
)

vcardDates

Definition at line 179 of file DateTimeParserTest.php.

References Sabre\VObject\$input, Sabre\VObject\$output, and Sabre\VObject\DateTimeParser\parseVCardDateTime().

179  {
180 
181  $this->assertEquals(
182  $output,
184  );
185 
186  }
if($argc< 3) $input
static parseVCardDateTime($date)
This method parses a vCard date and or time value.
+ Here is the call graph for this function:

◆ vcardDates()

Sabre\VObject\DateTimeParserTest::vcardDates ( )

Definition at line 206 of file DateTimeParserTest.php.

206  {
207 
208  return [
209  [
210  "19961022T140000",
211  [
212  "year" => 1996,
213  "month" => 10,
214  "date" => 22,
215  "hour" => 14,
216  "minute" => 00,
217  "second" => 00,
218  "timezone" => null
219  ],
220  ],
221  [
222  "--1022T1400",
223  [
224  "year" => null,
225  "month" => 10,
226  "date" => 22,
227  "hour" => 14,
228  "minute" => 00,
229  "second" => null,
230  "timezone" => null
231  ],
232  ],
233  [
234  "---22T14",
235  [
236  "year" => null,
237  "month" => null,
238  "date" => 22,
239  "hour" => 14,
240  "minute" => null,
241  "second" => null,
242  "timezone" => null
243  ],
244  ],
245  [
246  "19850412",
247  [
248  "year" => 1985,
249  "month" => 4,
250  "date" => 12,
251  "hour" => null,
252  "minute" => null,
253  "second" => null,
254  "timezone" => null
255  ],
256  ],
257  [
258  "1985-04",
259  [
260  "year" => 1985,
261  "month" => 04,
262  "date" => null,
263  "hour" => null,
264  "minute" => null,
265  "second" => null,
266  "timezone" => null
267  ],
268  ],
269  [
270  "1985",
271  [
272  "year" => 1985,
273  "month" => null,
274  "date" => null,
275  "hour" => null,
276  "minute" => null,
277  "second" => null,
278  "timezone" => null
279  ],
280  ],
281  [
282  "--0412",
283  [
284  "year" => null,
285  "month" => 4,
286  "date" => 12,
287  "hour" => null,
288  "minute" => null,
289  "second" => null,
290  "timezone" => null
291  ],
292  ],
293  [
294  "---12",
295  [
296  "year" => null,
297  "month" => null,
298  "date" => 12,
299  "hour" => null,
300  "minute" => null,
301  "second" => null,
302  "timezone" => null
303  ],
304  ],
305  [
306  "T102200",
307  [
308  "year" => null,
309  "month" => null,
310  "date" => null,
311  "hour" => 10,
312  "minute" => 22,
313  "second" => 0,
314  "timezone" => null
315  ],
316  ],
317  [
318  "T1022",
319  [
320  "year" => null,
321  "month" => null,
322  "date" => null,
323  "hour" => 10,
324  "minute" => 22,
325  "second" => null,
326  "timezone" => null
327  ],
328  ],
329  [
330  "T10",
331  [
332  "year" => null,
333  "month" => null,
334  "date" => null,
335  "hour" => 10,
336  "minute" => null,
337  "second" => null,
338  "timezone" => null
339  ],
340  ],
341  [
342  "T-2200",
343  [
344  "year" => null,
345  "month" => null,
346  "date" => null,
347  "hour" => null,
348  "minute" => 22,
349  "second" => 00,
350  "timezone" => null
351  ],
352  ],
353  [
354  "T--00",
355  [
356  "year" => null,
357  "month" => null,
358  "date" => null,
359  "hour" => null,
360  "minute" => null,
361  "second" => 00,
362  "timezone" => null
363  ],
364  ],
365  [
366  "T102200Z",
367  [
368  "year" => null,
369  "month" => null,
370  "date" => null,
371  "hour" => 10,
372  "minute" => 22,
373  "second" => 00,
374  "timezone" => 'Z'
375  ],
376  ],
377  [
378  "T102200-0800",
379  [
380  "year" => null,
381  "month" => null,
382  "date" => null,
383  "hour" => 10,
384  "minute" => 22,
385  "second" => 00,
386  "timezone" => '-0800'
387  ],
388  ],
389 
390  // extended format
391  [
392  "2012-11-29T15:10:53Z",
393  [
394  "year" => 2012,
395  "month" => 11,
396  "date" => 29,
397  "hour" => 15,
398  "minute" => 10,
399  "second" => 53,
400  "timezone" => 'Z'
401  ],
402  ],
403 
404  // with milliseconds
405  [
406  "20121129T151053.123Z",
407  [
408  "year" => 2012,
409  "month" => 11,
410  "date" => 29,
411  "hour" => 15,
412  "minute" => 10,
413  "second" => 53,
414  "timezone" => 'Z'
415  ],
416  ],
417 
418  // extended format with milliseconds
419  [
420  "2012-11-29T15:10:53.123Z",
421  [
422  "year" => 2012,
423  "month" => 11,
424  "date" => 29,
425  "hour" => 15,
426  "minute" => 10,
427  "second" => 53,
428  "timezone" => 'Z'
429  ],
430  ],
431  ];
432 
433  }

The documentation for this class was generated from the following file: