3 class Sabre_VObject_Component_VCalendarTest extends PHPUnit_Framework_TestCase {
6 * @dataProvider expandData
8 public function testExpand($input, $output) {
10 $vcal = Sabre_VObject_Reader::read($input);
12 new DateTime('2011-12-01'),
13 new DateTime('2011-12-31')
16 // This will normalize the output
17 $output = Sabre_VObject_Reader::read($output)->serialize();
19 $this->assertEquals($output, $vcal->serialize());
23 public function expandData() {
28 $input = 'BEGIN:VCALENDAR
35 $tests[] = array($input,$output);
39 $input = 'BEGIN:VCALENDAR
45 DTSTART;VALUE=DATE:20111202
50 DTSTART;VALUE=DATE:20120101
55 $output = 'BEGIN:VCALENDAR
61 DTSTART;VALUE=DATE:20111202
66 $tests[] = array($input, $output);
68 // Removing timezone info
69 $input = 'BEGIN:VCALENDAR
78 DTSTART;TZID=Europe/Paris:20111203T130102
83 $output = 'BEGIN:VCALENDAR
89 DTSTART;VALUE=DATE-TIME:20111203T120102Z
94 $tests[] = array($input, $output);
97 $input = 'BEGIN:VCALENDAR
102 SUMMARY:Testing RRule
103 DTSTART:20111125T120000Z
104 DTEND:20111125T130000Z
110 $output = 'BEGIN:VCALENDAR
115 SUMMARY:Testing RRule
116 DTSTART;VALUE=DATE-TIME:20111202T120000Z
117 DTEND;VALUE=DATE-TIME:20111202T130000Z
118 RECURRENCE-ID:20111202T120000Z
122 SUMMARY:Testing RRule
123 DTSTART;VALUE=DATE-TIME:20111209T120000Z
124 DTEND;VALUE=DATE-TIME:20111209T130000Z
125 RECURRENCE-ID:20111209T120000Z
129 SUMMARY:Testing RRule
130 DTSTART;VALUE=DATE-TIME:20111216T120000Z
131 DTEND;VALUE=DATE-TIME:20111216T130000Z
132 RECURRENCE-ID:20111216T120000Z
136 SUMMARY:Testing RRule
137 DTSTART;VALUE=DATE-TIME:20111223T120000Z
138 DTEND;VALUE=DATE-TIME:20111223T130000Z
139 RECURRENCE-ID:20111223T120000Z
143 SUMMARY:Testing RRule
144 DTSTART;VALUE=DATE-TIME:20111230T120000Z
145 DTEND;VALUE=DATE-TIME:20111230T130000Z
146 RECURRENCE-ID:20111230T120000Z
151 // Recurrence rule + override
152 $input = 'BEGIN:VCALENDAR
157 SUMMARY:Testing RRule2
158 DTSTART:20111125T120000Z
159 DTEND:20111125T130000Z
164 RECURRENCE-ID:20111209T120000Z
165 DTSTART:20111209T140000Z
166 DTEND:20111209T150000Z
172 $output = 'BEGIN:VCALENDAR
177 SUMMARY:Testing RRule2
178 DTSTART;VALUE=DATE-TIME:20111202T120000Z
179 DTEND;VALUE=DATE-TIME:20111202T130000Z
180 RECURRENCE-ID:20111202T120000Z
184 RECURRENCE-ID:20111209T120000Z
185 DTSTART:20111209T140000Z
186 DTEND:20111209T150000Z
191 SUMMARY:Testing RRule2
192 DTSTART;VALUE=DATE-TIME:20111216T120000Z
193 DTEND;VALUE=DATE-TIME:20111216T130000Z
194 RECURRENCE-ID:20111216T120000Z
198 SUMMARY:Testing RRule2
199 DTSTART;VALUE=DATE-TIME:20111223T120000Z
200 DTEND;VALUE=DATE-TIME:20111223T130000Z
201 RECURRENCE-ID:20111223T120000Z
205 SUMMARY:Testing RRule2
206 DTSTART;VALUE=DATE-TIME:20111230T120000Z
207 DTEND;VALUE=DATE-TIME:20111230T130000Z
208 RECURRENCE-ID:20111230T120000Z
213 $tests[] = array($input, $output);
219 * @expectedException LogicException
221 public function testBrokenEventExpand() {
223 $input = 'BEGIN:VCALENDAR
228 DTSTART;VALUE=DATE:20111202
232 $vcal = Sabre_VObject_Reader::read($input);
234 new DateTime('2011-12-01'),
235 new DateTime('2011-12-31')