annotate vendor/sabre/vobject/tests/VObject/Recur/RRuleIteratorTest.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\Recur;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use DateTime;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6 use DateTimeZone;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8 class RRuleIteratorTest 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 testHourly() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 'FREQ=HOURLY;INTERVAL=3;COUNT=12',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 '2011-10-07 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 '2011-10-07 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17 '2011-10-07 15:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 '2011-10-07 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 '2011-10-07 21:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 '2011-10-08 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21 '2011-10-08 03:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22 '2011-10-08 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 '2011-10-08 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 '2011-10-08 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 '2011-10-08 15:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 '2011-10-08 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 '2011-10-08 21:00:00',
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
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 function testDaily() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36 'FREQ=DAILY;INTERVAL=3;UNTIL=20111025T000000Z',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37 '2011-10-07',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 '2011-10-10 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 '2011-10-13 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42 '2011-10-16 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 '2011-10-19 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44 '2011-10-22 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45 '2011-10-25 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
47 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
48
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
49 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
50
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
51 function testDailyByDayByHour() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
52
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
53 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
54 'FREQ=DAILY;BYDAY=SA,SU;BYHOUR=6,7',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
55 '2011-10-08 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
56 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
57 '2011-10-08 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
58 '2011-10-08 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
59 '2011-10-09 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
60 '2011-10-09 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
61 '2011-10-15 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
62 '2011-10-15 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
63 '2011-10-16 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
64 '2011-10-16 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
65 '2011-10-22 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
66 '2011-10-22 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
67 '2011-10-23 06:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
68 '2011-10-23 07:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
69 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
70 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
71
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
72 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
73
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
74 function testDailyByHour() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
75
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
76 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
77 'FREQ=DAILY;INTERVAL=2;BYHOUR=10,11,12,13,14,15',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
78 '2012-10-11 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
79 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
80 '2012-10-11 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
81 '2012-10-11 13:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
82 '2012-10-11 14:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
83 '2012-10-11 15:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
84 '2012-10-13 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
85 '2012-10-13 11:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
86 '2012-10-13 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
87 '2012-10-13 13:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
88 '2012-10-13 14:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
89 '2012-10-13 15:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
90 '2012-10-15 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
91 '2012-10-15 11:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
92 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
93 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
94
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
95 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
96
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
97 function testDailyByDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
98
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
99 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
100 'FREQ=DAILY;INTERVAL=2;BYDAY=TU,WE,FR',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
101 '2011-10-07 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
102 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
103 '2011-10-07 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
104 '2011-10-11 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
105 '2011-10-19 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
106 '2011-10-21 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
107 '2011-10-25 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
108 '2011-11-02 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
109 '2011-11-04 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
110 '2011-11-08 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
111 '2011-11-16 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
112 '2011-11-18 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
113 '2011-11-22 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
114 '2011-11-30 12:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
115 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
116 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
117
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
118 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
119
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
120 function testDailyCount() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
121
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
122 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
123 'FREQ=DAILY;COUNT=5',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
124 '2014-08-01 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
125 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
126 '2014-08-01 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
127 '2014-08-02 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
128 '2014-08-03 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
129 '2014-08-04 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
130 '2014-08-05 18:03:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
131 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
132 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
133
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
134 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
135
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
136 function testDailyByMonth() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
137
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
138 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
139 'FREQ=DAILY;BYMONTH=9,10;BYDAY=SU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
140 '2007-10-04 16:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
141 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
142 "2013-09-29 16:00:00",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
143 "2013-10-06 16:00:00",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
144 "2013-10-13 16:00:00",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
145 "2013-10-20 16:00:00",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
146 "2013-10-27 16:00:00",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
147 "2014-09-07 16:00:00"
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
148 ),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
149 '2013-09-28'
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
150 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
151
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
152 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
153
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
154 function testWeekly() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
155
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
156 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
157 'FREQ=WEEKLY;INTERVAL=2;COUNT=10',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
158 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
159 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
160 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
161 '2011-10-21 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
162 '2011-11-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
163 '2011-11-18 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
164 '2011-12-02 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
165 '2011-12-16 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
166 '2011-12-30 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
167 '2012-01-13 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
168 '2012-01-27 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
169 '2012-02-10 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
170 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
171 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
172
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
173 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
174
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
175 function testWeeklyByDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
176
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
177 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
178 'FREQ=WEEKLY;INTERVAL=1;COUNT=4;BYDAY=MO;WKST=SA',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
179 '2014-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
180 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
181 '2014-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
182 '2014-08-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
183 '2014-08-11 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
184 '2014-08-18 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
185 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
186 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
187
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
188 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
189
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
190 function testWeeklyByDay2() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
191
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
192 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
193 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
194 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
195 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
196 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
197 '2011-10-18 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
198 '2011-10-19 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
199 '2011-10-21 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
200 '2011-11-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
201 '2011-11-02 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
202 '2011-11-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
203 '2011-11-15 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
204 '2011-11-16 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
205 '2011-11-18 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
206 '2011-11-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
207 '2011-11-30 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
208 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
209 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
210
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
211 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
212
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
213 function testWeeklyByDayByHour() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
214
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
215 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
216 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=MO;BYHOUR=8,9,10',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
217 '2011-10-07 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
218 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
219 '2011-10-07 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
220 '2011-10-07 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
221 '2011-10-07 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
222 '2011-10-18 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
223 '2011-10-18 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
224 '2011-10-18 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
225 '2011-10-19 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
226 '2011-10-19 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
227 '2011-10-19 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
228 '2011-10-21 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
229 '2011-10-21 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
230 '2011-10-21 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
231 '2011-11-01 08:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
232 '2011-11-01 09:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
233 '2011-11-01 10:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
234 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
235 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
236
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
237 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
238
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
239 function testWeeklyByDaySpecificHour() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
240
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
241 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
242 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
243 '2011-10-07 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
244 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
245 '2011-10-07 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
246 '2011-10-18 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
247 '2011-10-19 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
248 '2011-10-21 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
249 '2011-11-01 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
250 '2011-11-02 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
251 '2011-11-04 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
252 '2011-11-15 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
253 '2011-11-16 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
254 '2011-11-18 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
255 '2011-11-29 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
256 '2011-11-30 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
257 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
258 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
259
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
260 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
261
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
262 function testMonthly() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
263
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
264 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
265 'FREQ=MONTHLY;INTERVAL=3;COUNT=5',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
266 '2011-12-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
267 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
268 '2011-12-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
269 '2012-03-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
270 '2012-06-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
271 '2012-09-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
272 '2012-12-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
273 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
274 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
275
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
276 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
277
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
278 function testMonlthyEndOfMonth() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
279
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
280 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
281 'FREQ=MONTHLY;INTERVAL=2;COUNT=12',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
282 '2011-12-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
283 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
284 '2011-12-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
285 '2012-08-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
286 '2012-10-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
287 '2012-12-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
288 '2013-08-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
289 '2013-10-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
290 '2013-12-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
291 '2014-08-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
292 '2014-10-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
293 '2014-12-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
294 '2015-08-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
295 '2015-10-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
296 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
297 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
298
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
299 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
300
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
301 function testMonthlyByMonthDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
302
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
303 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
304 'FREQ=MONTHLY;INTERVAL=5;COUNT=9;BYMONTHDAY=1,31,-7',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
305 '2011-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
306 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
307 '2011-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
308 '2011-01-25 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
309 '2011-01-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
310 '2011-06-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
311 '2011-06-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
312 '2011-11-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
313 '2011-11-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
314 '2012-04-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
315 '2012-04-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
316 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
317 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
318
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
319 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
320
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
321 function testMonthlyByDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
322
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
323 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
324 'FREQ=MONTHLY;INTERVAL=2;COUNT=16;BYDAY=MO,-2TU,+1WE,3TH',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
325 '2011-01-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
326 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
327 '2011-01-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
328 '2011-01-05 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
329 '2011-01-10 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
330 '2011-01-17 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
331 '2011-01-18 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
332 '2011-01-20 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
333 '2011-01-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
334 '2011-01-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
335 '2011-03-02 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
336 '2011-03-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
337 '2011-03-14 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
338 '2011-03-17 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
339 '2011-03-21 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
340 '2011-03-22 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
341 '2011-03-28 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
342 '2011-05-02 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
343 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
344 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
345
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
346 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
347
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
348 function testMonthlyByDayByMonthDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
349
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
350 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
351 'FREQ=MONTHLY;COUNT=10;BYDAY=MO;BYMONTHDAY=1',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
352 '2011-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
353 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
354 '2011-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
355 '2012-10-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
356 '2013-04-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
357 '2013-07-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
358 '2014-09-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
359 '2014-12-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
360 '2015-06-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
361 '2016-02-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
362 '2016-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
363 '2017-05-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
364 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
365 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
366
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
367 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
368
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
369 function testMonthlyByDayBySetPos() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
370
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
371 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
372 'FREQ=MONTHLY;COUNT=10;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,-1',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
373 '2011-01-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
374 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
375 '2011-01-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
376 '2011-01-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
377 '2011-02-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
378 '2011-02-28 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
379 '2011-03-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
380 '2011-03-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
381 '2011-04-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
382 '2011-04-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
383 '2011-05-02 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
384 '2011-05-31 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
385 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
386 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
387
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
388 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
389
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
390 function testYearly() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
391
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
392 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
393 'FREQ=YEARLY;COUNT=10;INTERVAL=3',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
394 '2011-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
395 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
396 '2011-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
397 '2014-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
398 '2017-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
399 '2020-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
400 '2023-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
401 '2026-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
402 '2029-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
403 '2032-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
404 '2035-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
405 '2038-01-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
406 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
407 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
408 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
409
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
410 function testYearlyLeapYear() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
411
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
412 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
413 'FREQ=YEARLY;COUNT=3',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
414 '2012-02-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
415 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
416 '2012-02-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
417 '2016-02-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
418 '2020-02-29 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
419 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
420 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
421 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
422
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
423 function testYearlyByMonth() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
424
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
425 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
426 'FREQ=YEARLY;COUNT=8;INTERVAL=4;BYMONTH=4,10',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
427 '2011-04-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
428 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
429 '2011-04-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
430 '2011-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
431 '2015-04-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
432 '2015-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
433 '2019-04-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
434 '2019-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
435 '2023-04-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
436 '2023-10-07 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
437 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
438 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
439
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
440 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
441
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
442 function testYearlyByMonthByDay() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
443
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
444 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
445 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
446 '2011-04-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
447 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
448 '2011-04-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
449 '2011-04-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
450 '2011-10-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
451 '2011-10-30 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
452 '2016-04-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
453 '2016-04-24 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
454 '2016-10-03 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
455 '2016-10-30 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
456 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
457 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
458
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
459 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
460
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
461 function testFastForward() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
462
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
463 // The idea is that we're fast-forwarding too far in the future, so
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
464 // there will be no results left.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
465 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
466 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
467 '2011-04-04 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
468 array(),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
469 '2020-05-05 00:00:00'
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
470 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
471
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
472 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
473
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
474 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
475 * The bug that was in the
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
476 * system before would fail on the 5th tuesday of the month, if the 5th
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
477 * tuesday did not exist.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
478 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
479 * A pretty slow test. Had to be marked as 'medium' for phpunit to not die
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
480 * after 1 second. Would be good to optimize later.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
481 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
482 * @medium
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
483 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
484 function testFifthTuesdayProblem() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
485
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
486 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
487 'FREQ=MONTHLY;INTERVAL=1;UNTIL=20071030T035959Z;BYDAY=5TU',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
488 '2007-10-04 14:46:42',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
489 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
490 "2007-10-04 14:46:42",
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
491 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
492 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
493
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
494 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
495
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
496 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
497 * This bug came from a Fruux customer. This would result in a never-ending
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
498 * request.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
499 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
500 function testFastFowardTooFar() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
501
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
502 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
503 'FREQ=WEEKLY;BYDAY=MO;UNTIL=20090704T205959Z;INTERVAL=1',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
504 '2009-04-20 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
505 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
506 '2009-04-20 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
507 '2009-04-27 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
508 '2009-05-04 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
509 '2009-05-11 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
510 '2009-05-18 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
511 '2009-05-25 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
512 '2009-06-01 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
513 '2009-06-08 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
514 '2009-06-15 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
515 '2009-06-22 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
516 '2009-06-29 18:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
517 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
518 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
519
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
520 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
521
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
522 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
523 * This also at one point caused an infinite loop. We're keeping the test.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
524 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
525 function testYearlyByMonthLoop() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
526
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
527 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
528 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
529 '2012-01-01 15:45:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
530 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
531 '2012-02-01 15:45:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
532 ),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
533 '2012-01-29 23:00:00'
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
534 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
535
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
536
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
537 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
538
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
539 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
540 * Something, somewhere produced an ics with an interval set to 0. Because
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
541 * this means we increase the current day (or week, month) by 0, this also
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
542 * results in an infinite loop.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
543 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
544 * @expectedException InvalidArgumentException
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
545 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
546 function testZeroInterval() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
547
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
548 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
549 'FREQ=YEARLY;INTERVAL=0',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
550 '2012-08-24 14:57:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
551 array(),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
552 '2013-01-01 23:00:00'
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
553 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
554
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
555 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
556
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
557 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
558 * @expectedException InvalidArgumentException
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
559 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
560 function testInvalidFreq() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
561
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
562 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
563 'FREQ=SMONTHLY;INTERVAL=3;UNTIL=20111025T000000Z',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
564 '2011-10-07',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
565 array()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
566 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
567
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
568 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
569
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
570 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
571 * @expectedException InvalidArgumentException
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
572 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
573 function testByDayBadOffset() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
574
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
575 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
576 'FREQ=WEEKLY;INTERVAL=1;COUNT=4;BYDAY=0MO;WKST=SA',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
577 '2014-08-01 00:00:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
578 array()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
579 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
580
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
581 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
582
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
583 function testUntilBeginHAsTimezone() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
584
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
585 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
586 'FREQ=WEEKLY;UNTIL=20131118T183000',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
587 '2013-09-23 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
588 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
589 '2013-09-23 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
590 '2013-09-30 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
591 '2013-10-07 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
592 '2013-10-14 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
593 '2013-10-21 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
594 '2013-10-28 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
595 '2013-11-04 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
596 '2013-11-11 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
597 '2013-11-18 18:30:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
598 ),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
599 null,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
600 'America/New_York'
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
601 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
602
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
603 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
604
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
605 function testUntilBeforeDtStart() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
606
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
607 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
608 'FREQ=DAILY;UNTIL=20140101T000000Z',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
609 '2014-08-02 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
610 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
611 '2014-08-02 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
612 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
613 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
614
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
615 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
616
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
617 function testIgnoredStuff() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
618
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
619 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
620 'FREQ=DAILY;BYSECOND=1;BYMINUTE=1;BYYEARDAY=1;BYWEEKNO=1;COUNT=2',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
621 '2014-08-02 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
622 array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
623 '2014-08-02 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
624 '2014-08-03 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
625 )
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
626 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
627
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
628 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
629
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
630 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
631 * @expectedException InvalidArgumentException
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
632 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
633 function testUnsupportedPart() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
634
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
635 $this->parse(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
636 'FREQ=DAILY;BYWODAN=1',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
637 '2014-08-02 00:15:00',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
638 array()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
639 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
640
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
641 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
642
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
643 function testIteratorFunctions() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
644
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
645 $parser = new RRuleIterator('FREQ=DAILY', new DateTime('2014-08-02 00:00:13'));
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
646 $parser->next();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
647 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
648 new DateTime('2014-08-03 00:00:13'),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
649 $parser->current()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
650 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
651 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
652 1,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
653 $parser->key()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
654 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
655
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
656 $parser->rewind();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
657
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
658 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
659 new DateTime('2014-08-02 00:00:13'),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
660 $parser->current()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
661 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
662 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
663 0,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
664 $parser->key()
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
665 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
666
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
667 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
668
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
669 function parse($rule, $start, $expected, $fastForward = null, $tz = 'UTC') {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
670
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
671 $dt = new DateTime($start, new DateTimeZone($tz));
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
672 $parser = new RRuleIterator($rule, $dt);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
673
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
674 if ($fastForward) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
675 $parser->fastForward(new DateTime($fastForward));
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
676 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
677
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
678 $result = array();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
679 while($parser->valid()) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
680
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
681 $item = $parser->current();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
682 $result[] = $item->format('Y-m-d H:i:s');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
683
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
684 if ($parser->isInfinite() && count($result) >= count($expected)) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
685 break;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
686 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
687 $parser->next();
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
688
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
689 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
690
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
691 $this->assertEquals(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
692 $expected,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
693 $result
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
694 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
695
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
696 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
697
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
698 }