ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Component\VAlarmTest Class Reference
+ Inheritance diagram for Sabre\VObject\Component\VAlarmTest:
+ Collaboration diagram for Sabre\VObject\Component\VAlarmTest:

Public Member Functions

 testInTimeRange (VAlarm $valarm, $start, $end, $outcome)
 timeRangeTestData More...
 
 timeRangeTestData ()
 
 testInTimeRangeInvalidComponent ()
 
 testInTimeRangeBuggy ()
 This bug was found and reported on the mailing list. More...
 

Detailed Description

Definition at line 9 of file VAlarmTest.php.

Member Function Documentation

◆ testInTimeRange()

Sabre\VObject\Component\VAlarmTest::testInTimeRange ( VAlarm  $valarm,
  $start,
  $end,
  $outcome 
)

timeRangeTestData

Definition at line 14 of file VAlarmTest.php.

References $end, $start, and Sabre\VObject\Component\VAlarm\isInTimeRange().

14  {
15 
16  $this->assertEquals($outcome, $valarm->isInTimeRange($start, $end));
17 
18  }
$start
Definition: bench.php:8
+ Here is the call graph for this function:

◆ testInTimeRangeBuggy()

Sabre\VObject\Component\VAlarmTest::testInTimeRangeBuggy ( )

This bug was found and reported on the mailing list.

Definition at line 152 of file VAlarmTest.php.

References Sabre\VObject\$input, $vobj, and Sabre\VObject\Reader\read().

152  {
153 
154 $input = <<<BLA
155 BEGIN:VCALENDAR
156 BEGIN:VTODO
157 DTSTAMP:20121003T064931Z
158 UID:b848cb9a7bb16e464a06c222ca1f8102@examle.com
159 STATUS:NEEDS-ACTION
160 DUE:20121005T000000Z
161 SUMMARY:Task 1
162 CATEGORIES:AlarmCategory
163 BEGIN:VALARM
164 TRIGGER:-PT10M
165 ACTION:DISPLAY
166 DESCRIPTION:Task 1
167 END:VALARM
168 END:VTODO
169 END:VCALENDAR
170 BLA;
171 
173 
174  $this->assertTrue($vobj->VTODO->VALARM->isInTimeRange(new \DateTime('2012-10-01 00:00:00'), new \DateTime('2012-11-01 00:00:00')));
175 
176  }
if($argc< 3) $input
$vobj
Definition: rrulebench.php:21
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
+ Here is the call graph for this function:

◆ testInTimeRangeInvalidComponent()

Sabre\VObject\Component\VAlarmTest::testInTimeRangeInvalidComponent ( )

Definition at line 135 of file VAlarmTest.php.

References $calendar.

135  {
136 
137  $calendar = new VCalendar();
138  $valarm = $calendar->createComponent('VALARM');
139  $valarm->TRIGGER = '-P1D';
140  $valarm->TRIGGER['RELATED'] = 'END';
141 
142  $vjournal = $calendar->createComponent('VJOURNAL');
143  $vjournal->add($valarm);
144 
145  $valarm->isInTimeRange(new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'));
146 
147  }

◆ timeRangeTestData()

Sabre\VObject\Component\VAlarmTest::timeRangeTestData ( )

Definition at line 20 of file VAlarmTest.php.

References $calendar, and $tests.

20  {
21 
22  $tests = [];
23 
24  $calendar = new VCalendar();
25 
26  // Hard date and time
27  $valarm1 = $calendar->createComponent('VALARM');
28  $valarm1->add(
29  $calendar->createProperty('TRIGGER', '20120312T130000Z', ['VALUE' => 'DATE-TIME'])
30  );
31 
32  $tests[] = [$valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true];
33  $tests[] = [$valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false];
34 
35  // Relation to start time of event
36  $valarm2 = $calendar->createComponent('VALARM');
37  $valarm2->add(
38  $calendar->createProperty('TRIGGER', '-P1D', ['VALUE' => 'DURATION'])
39  );
40 
41  $vevent2 = $calendar->createComponent('VEVENT');
42  $vevent2->DTSTART = '20120313T130000Z';
43  $vevent2->add($valarm2);
44 
45  $tests[] = [$valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true];
46  $tests[] = [$valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false];
47 
48  // Relation to end time of event
49  $valarm3 = $calendar->createComponent('VALARM');
50  $valarm3->add($calendar->createProperty('TRIGGER', '-P1D', ['VALUE' => 'DURATION', 'RELATED' => 'END']));
51 
52  $vevent3 = $calendar->createComponent('VEVENT');
53  $vevent3->DTSTART = '20120301T130000Z';
54  $vevent3->DTEND = '20120401T130000Z';
55  $vevent3->add($valarm3);
56 
57  $tests[] = [$valarm3, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false];
58  $tests[] = [$valarm3, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true];
59 
60  // Relation to end time of todo
61  $valarm4 = $calendar->createComponent('VALARM');
62  $valarm4->TRIGGER = '-P1D';
63  $valarm4->TRIGGER['VALUE'] = 'DURATION';
64  $valarm4->TRIGGER['RELATED'] = 'END';
65 
66  $vtodo4 = $calendar->createComponent('VTODO');
67  $vtodo4->DTSTART = '20120301T130000Z';
68  $vtodo4->DUE = '20120401T130000Z';
69  $vtodo4->add($valarm4);
70 
71  $tests[] = [$valarm4, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false];
72  $tests[] = [$valarm4, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true];
73 
74  // Relation to start time of event + repeat
75  $valarm5 = $calendar->createComponent('VALARM');
76  $valarm5->TRIGGER = '-P1D';
77  $valarm5->TRIGGER['VALUE'] = 'DURATION';
78  $valarm5->REPEAT = 10;
79  $valarm5->DURATION = 'P1D';
80 
81  $vevent5 = $calendar->createComponent('VEVENT');
82  $vevent5->DTSTART = '20120301T130000Z';
83  $vevent5->add($valarm5);
84 
85  $tests[] = [$valarm5, new DateTime('2012-03-09 01:00:00'), new DateTime('2012-03-10 01:00:00'), true];
86 
87  // Relation to start time of event + duration, but no repeat
88  $valarm6 = $calendar->createComponent('VALARM');
89  $valarm6->TRIGGER = '-P1D';
90  $valarm6->TRIGGER['VALUE'] = 'DURATION';
91  $valarm6->DURATION = 'P1D';
92 
93  $vevent6 = $calendar->createComponent('VEVENT');
94  $vevent6->DTSTART = '20120313T130000Z';
95  $vevent6->add($valarm6);
96 
97  $tests[] = [$valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true];
98  $tests[] = [$valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false];
99 
100 
101  // Relation to end time of event (DURATION instead of DTEND)
102  $valarm7 = $calendar->createComponent('VALARM');
103  $valarm7->TRIGGER = '-P1D';
104  $valarm7->TRIGGER['VALUE'] = 'DURATION';
105  $valarm7->TRIGGER['RELATED'] = 'END';
106 
107  $vevent7 = $calendar->createComponent('VEVENT');
108  $vevent7->DTSTART = '20120301T130000Z';
109  $vevent7->DURATION = 'P30D';
110  $vevent7->add($valarm7);
111 
112  $tests[] = [$valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false];
113  $tests[] = [$valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true];
114 
115  // Relation to end time of event (No DTEND or DURATION)
116  $valarm7 = $calendar->createComponent('VALARM');
117  $valarm7->TRIGGER = '-P1D';
118  $valarm7->TRIGGER['VALUE'] = 'DURATION';
119  $valarm7->TRIGGER['RELATED'] = 'END';
120 
121  $vevent7 = $calendar->createComponent('VEVENT');
122  $vevent7->DTSTART = '20120301T130000Z';
123  $vevent7->add($valarm7);
124 
125  $tests[] = [$valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), true];
126  $tests[] = [$valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), false];
127 
128 
129  return $tests;
130  }
$tests
Definition: bench.php:104

The documentation for this class was generated from the following file: