annotate vendor/sabre/vobject/tests/VObject/Component/VTimeZoneTest.php @ 7:430dbd5346f7

vendor sabre as distributed
author Charlie Root
date Sat, 13 Jan 2018 09:06:10 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject\Component;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use Sabre\VObject;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6 use Sabre\VObject\Reader;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8 class VTimeZoneTest extends \PHPUnit_Framework_TestCase {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10 function testValidate() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 $input = <<<HI
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 BEGIN:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 VERSION:2.0
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 PRODID:YoYo
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 BEGIN:VTIMEZONE
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17 TZID:America/Toronto
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 END:VTIMEZONE
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 END:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 HI;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22 $obj = Reader::read($input);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 $warnings = $obj->validate();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 $messages = array();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 foreach($warnings as $warning) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 $messages[] = $warning['message'];
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30 $this->assertEquals(array(), $messages);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34 function testGetTimeZone() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36 $input = <<<HI
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37 BEGIN:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38 VERSION:2.0
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39 PRODID:YoYo
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 BEGIN:VTIMEZONE
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 TZID:America/Toronto
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42 END:VTIMEZONE
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 END:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44 HI;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46 $obj = Reader::read($input);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
47
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
48 $tz = new \DateTimeZone('America/Toronto');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
49
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
50 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
51 $tz,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
52 $obj->VTIMEZONE->getTimeZone()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
53 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
54
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
55 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
56
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
57 }