ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
OverrideFirstEventTest.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use DateTime;
8 
9 class OverrideFirstEventTest extends TestCase {
10 
11  use \Sabre\VObject\PHPUnitAssertions;
12 
14 
15  $input = <<<ICS
16 BEGIN:VCALENDAR
17 VERSION:2.0
18 BEGIN:VEVENT
19 UID:foobar
20 DTSTART:20140803T120000Z
21 RRULE:FREQ=WEEKLY
22 SUMMARY:Original
23 END:VEVENT
24 BEGIN:VEVENT
25 UID:foobar
26 RECURRENCE-ID:20140803T120000Z
27 DTSTART:20140803T120000Z
28 SUMMARY:Overridden
29 END:VEVENT
30 END:VCALENDAR
31 ICS;
32 
34  $vcal = $vcal->expand(new DateTime('2014-08-01'), new DateTime('2014-09-01'));
35 
36  $expected = <<<ICS
37 BEGIN:VCALENDAR
38 VERSION:2.0
39 BEGIN:VEVENT
40 UID:foobar
41 RECURRENCE-ID:20140803T120000Z
42 DTSTART:20140803T120000Z
43 SUMMARY:Overridden
44 END:VEVENT
45 BEGIN:VEVENT
46 UID:foobar
47 DTSTART:20140810T120000Z
48 SUMMARY:Original
49 RECURRENCE-ID:20140810T120000Z
50 END:VEVENT
51 BEGIN:VEVENT
52 UID:foobar
53 DTSTART:20140817T120000Z
54 SUMMARY:Original
55 RECURRENCE-ID:20140817T120000Z
56 END:VEVENT
57 BEGIN:VEVENT
58 UID:foobar
59 DTSTART:20140824T120000Z
60 SUMMARY:Original
61 RECURRENCE-ID:20140824T120000Z
62 END:VEVENT
63 BEGIN:VEVENT
64 UID:foobar
65 DTSTART:20140831T120000Z
66 SUMMARY:Original
67 RECURRENCE-ID:20140831T120000Z
68 END:VEVENT
69 END:VCALENDAR
70 ICS;
71 
72  $this->assertVObjectEqualsVObject(
73  $expected,
74  $vcal
75  );
76 
77 
78  }
79 
80  function testRemoveFirstEvent() {
81 
82  $input = <<<ICS
83 BEGIN:VCALENDAR
84 VERSION:2.0
85 BEGIN:VEVENT
86 UID:foobar
87 DTSTART:20140803T120000Z
88 RRULE:FREQ=WEEKLY
89 EXDATE:20140803T120000Z
90 SUMMARY:Original
91 END:VEVENT
92 END:VCALENDAR
93 ICS;
94 
96  $vcal = $vcal->expand(new DateTime('2014-08-01'), new DateTime('2014-08-19'));
97 
98  $expected = <<<ICS
99 BEGIN:VCALENDAR
100 VERSION:2.0
101 BEGIN:VEVENT
102 UID:foobar
103 DTSTART:20140810T120000Z
104 SUMMARY:Original
105 RECURRENCE-ID:20140810T120000Z
106 END:VEVENT
107 BEGIN:VEVENT
108 UID:foobar
109 DTSTART:20140817T120000Z
110 SUMMARY:Original
111 RECURRENCE-ID:20140817T120000Z
112 END:VEVENT
113 END:VCALENDAR
114 ICS;
115 
116  $this->assertVObjectEqualsVObject(
117  $expected,
118  $vcal
119  );
120 
121  }
122 }
if($argc< 3) $input
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42