3 namespace Sabre\VObject\Component;
7 class VCalendarTest extends \PHPUnit_Framework_TestCase {
10 * @dataProvider expandData
12 public function testExpand($input, $output) {
14 $vcal = VObject\Reader::read($input);
16 new \DateTime('2011-12-01'),
17 new \DateTime('2011-12-31')
20 // This will normalize the output
21 $output = VObject\Reader::read($output)->serialize();
23 $this->assertEquals($output, $vcal->serialize());
27 public function expandData() {
32 $input = 'BEGIN:VCALENDAR
39 $tests[] = array($input,$output);
43 $input = 'BEGIN:VCALENDAR
49 DTSTART;VALUE=DATE:20111202
54 DTSTART;VALUE=DATE:20120101
59 $output = 'BEGIN:VCALENDAR
65 DTSTART;VALUE=DATE:20111202
70 $tests[] = array($input, $output);
72 // Removing timezone info
73 $input = 'BEGIN:VCALENDAR
82 DTSTART;TZID=Europe/Paris:20111203T130102
87 $output = 'BEGIN:VCALENDAR
93 DTSTART;VALUE=DATE-TIME:20111203T120102Z
98 $tests[] = array($input, $output);
101 $input = 'BEGIN:VCALENDAR
106 SUMMARY:Testing RRule
107 DTSTART:20111125T120000Z
108 DTEND:20111125T130000Z
114 $output = 'BEGIN:VCALENDAR
119 SUMMARY:Testing RRule
120 DTSTART;VALUE=DATE-TIME:20111202T120000Z
121 DTEND;VALUE=DATE-TIME:20111202T130000Z
122 RECURRENCE-ID:20111202T120000Z
126 SUMMARY:Testing RRule
127 DTSTART;VALUE=DATE-TIME:20111209T120000Z
128 DTEND;VALUE=DATE-TIME:20111209T130000Z
129 RECURRENCE-ID:20111209T120000Z
133 SUMMARY:Testing RRule
134 DTSTART;VALUE=DATE-TIME:20111216T120000Z
135 DTEND;VALUE=DATE-TIME:20111216T130000Z
136 RECURRENCE-ID:20111216T120000Z
140 SUMMARY:Testing RRule
141 DTSTART;VALUE=DATE-TIME:20111223T120000Z
142 DTEND;VALUE=DATE-TIME:20111223T130000Z
143 RECURRENCE-ID:20111223T120000Z
147 SUMMARY:Testing RRule
148 DTSTART;VALUE=DATE-TIME:20111230T120000Z
149 DTEND;VALUE=DATE-TIME:20111230T130000Z
150 RECURRENCE-ID:20111230T120000Z
155 // Recurrence rule + override
156 $input = 'BEGIN:VCALENDAR
161 SUMMARY:Testing RRule2
162 DTSTART:20111125T120000Z
163 DTEND:20111125T130000Z
168 RECURRENCE-ID:20111209T120000Z
169 DTSTART:20111209T140000Z
170 DTEND:20111209T150000Z
176 $output = 'BEGIN:VCALENDAR
181 SUMMARY:Testing RRule2
182 DTSTART;VALUE=DATE-TIME:20111202T120000Z
183 DTEND;VALUE=DATE-TIME:20111202T130000Z
184 RECURRENCE-ID:20111202T120000Z
188 RECURRENCE-ID:20111209T120000Z
189 DTSTART:20111209T140000Z
190 DTEND:20111209T150000Z
195 SUMMARY:Testing RRule2
196 DTSTART;VALUE=DATE-TIME:20111216T120000Z
197 DTEND;VALUE=DATE-TIME:20111216T130000Z
198 RECURRENCE-ID:20111216T120000Z
202 SUMMARY:Testing RRule2
203 DTSTART;VALUE=DATE-TIME:20111223T120000Z
204 DTEND;VALUE=DATE-TIME:20111223T130000Z
205 RECURRENCE-ID:20111223T120000Z
209 SUMMARY:Testing RRule2
210 DTSTART;VALUE=DATE-TIME:20111230T120000Z
211 DTEND;VALUE=DATE-TIME:20111230T130000Z
212 RECURRENCE-ID:20111230T120000Z
217 $tests[] = array($input, $output);
223 * @expectedException LogicException
225 public function testBrokenEventExpand() {
227 $input = 'BEGIN:VCALENDAR
232 DTSTART;VALUE=DATE:20111202
236 $vcal = VObject\Reader::read($input);
238 new \DateTime('2011-12-01'),
239 new \DateTime('2011-12-31')