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

Public Member Functions

 testInTimeRange (VTodo $vtodo, $start, $end, $outcome)
 @dataProvider timeRangeTestData More...
 
 timeRangeTestData ()
 
 testValidate ()
 
 testValidateInvalid ()
 
 testValidateDUEDTSTARTMisMatch ()
 
 testValidateDUEbeforeDTSTART ()
 

Detailed Description

Definition at line 9 of file VTodoTest.php.

Member Function Documentation

◆ testInTimeRange()

Sabre\VObject\Component\VTodoTest::testInTimeRange ( VTodo  $vtodo,
  $start,
  $end,
  $outcome 
)

@dataProvider timeRangeTestData

Definition at line 14 of file VTodoTest.php.

14 {
15
16 $this->assertEquals($outcome, $vtodo->isInTimeRange($start, $end));
17
18 }
$start
Definition: bench.php:8

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

+ Here is the call graph for this function:

◆ testValidate()

Sabre\VObject\Component\VTodoTest::testValidate ( )

Definition at line 70 of file VTodoTest.php.

70 {
71
72 $input = <<<HI
73BEGIN:VCALENDAR
74VERSION:2.0
75PRODID:YoYo
76BEGIN:VTODO
77UID:1234-21355-123156
78DTSTAMP:20140402T183400Z
79END:VTODO
80END:VCALENDAR
81HI;
82
83 $obj = Reader::read($input);
84
85 $warnings = $obj->validate();
86 $messages = [];
87 foreach ($warnings as $warning) {
88 $messages[] = $warning['message'];
89 }
90
91 $this->assertEquals([], $messages);
92
93 }
$warning
Definition: X509warning.php:13
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
$messages
Definition: en.php:5
foreach($paths as $path) if($argc< 3) $input

References Sabre\VObject\$input, $messages, $warning, $warnings, and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testValidateDUEbeforeDTSTART()

Sabre\VObject\Component\VTodoTest::testValidateDUEbeforeDTSTART ( )

Definition at line 150 of file VTodoTest.php.

150 {
151
152 $input = <<<HI
153BEGIN:VCALENDAR
154VERSION:2.0
155PRODID:YoYo
156BEGIN:VTODO
157UID:FOO
158DTSTART;VALUE=DATE:20140520
159DUE;VALUE=DATE:20140518
160DTSTAMP;VALUE=DATE-TIME:20140520T131600Z
161END:VTODO
162END:VCALENDAR
163HI;
164
165 $obj = Reader::read($input);
166
167 $warnings = $obj->validate();
168 $messages = [];
169 foreach ($warnings as $warning) {
170 $messages[] = $warning['message'];
171 }
172
173 $this->assertEquals([
174 "DUE must occur after DTSTART",
175 ], $messages);
176
177 }

References Sabre\VObject\$input, $messages, $warning, $warnings, and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testValidateDUEDTSTARTMisMatch()

Sabre\VObject\Component\VTodoTest::testValidateDUEDTSTARTMisMatch ( )

Definition at line 121 of file VTodoTest.php.

121 {
122
123 $input = <<<HI
124BEGIN:VCALENDAR
125VERSION:2.0
126PRODID:YoYo
127BEGIN:VTODO
128UID:FOO
129DTSTART;VALUE=DATE-TIME:20140520T131600Z
130DUE;VALUE=DATE:20140520
131DTSTAMP;VALUE=DATE-TIME:20140520T131600Z
132END:VTODO
133END:VCALENDAR
134HI;
135
136 $obj = Reader::read($input);
137
138 $warnings = $obj->validate();
139 $messages = [];
140 foreach ($warnings as $warning) {
141 $messages[] = $warning['message'];
142 }
143
144 $this->assertEquals([
145 "The value type (DATE or DATE-TIME) must be identical for DUE and DTSTART",
146 ], $messages);
147
148 }

References Sabre\VObject\$input, $messages, $warning, $warnings, and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ testValidateInvalid()

Sabre\VObject\Component\VTodoTest::testValidateInvalid ( )

Definition at line 95 of file VTodoTest.php.

95 {
96
97 $input = <<<HI
98BEGIN:VCALENDAR
99VERSION:2.0
100PRODID:YoYo
101BEGIN:VTODO
102END:VTODO
103END:VCALENDAR
104HI;
105
106 $obj = Reader::read($input);
107
108 $warnings = $obj->validate();
109 $messages = [];
110 foreach ($warnings as $warning) {
111 $messages[] = $warning['message'];
112 }
113
114 $this->assertEquals([
115 "UID MUST appear exactly once in a VTODO component",
116 "DTSTAMP MUST appear exactly once in a VTODO component",
117 ], $messages);
118
119 }

References Sabre\VObject\$input, $messages, $warning, $warnings, and Sabre\VObject\Reader\read().

+ Here is the call graph for this function:

◆ timeRangeTestData()

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

Definition at line 20 of file VTodoTest.php.

20 {
21
22 $tests = [];
23
24 $calendar = new VCalendar();
25
26 $vtodo = $calendar->createComponent('VTODO');
27 $vtodo->DTSTART = '20111223T120000Z';
28 $tests[] = [$vtodo, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
29 $tests[] = [$vtodo, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
30
31 $vtodo2 = clone $vtodo;
32 $vtodo2->DURATION = 'P1D';
33 $tests[] = [$vtodo2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
34 $tests[] = [$vtodo2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
35
36 $vtodo3 = clone $vtodo;
37 $vtodo3->DUE = '20111225';
38 $tests[] = [$vtodo3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
39 $tests[] = [$vtodo3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
40
41 $vtodo4 = $calendar->createComponent('VTODO');
42 $vtodo4->DUE = '20111225';
43 $tests[] = [$vtodo4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
44 $tests[] = [$vtodo4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
45
46 $vtodo5 = $calendar->createComponent('VTODO');
47 $vtodo5->COMPLETED = '20111225';
48 $tests[] = [$vtodo5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
49 $tests[] = [$vtodo5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
50
51 $vtodo6 = $calendar->createComponent('VTODO');
52 $vtodo6->CREATED = '20111225';
53 $tests[] = [$vtodo6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
54 $tests[] = [$vtodo6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
55
56 $vtodo7 = $calendar->createComponent('VTODO');
57 $vtodo7->CREATED = '20111225';
58 $vtodo7->COMPLETED = '20111226';
59 $tests[] = [$vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
60 $tests[] = [$vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false];
61
62 $vtodo7 = $calendar->createComponent('VTODO');
63 $tests[] = [$vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true];
64 $tests[] = [$vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), true];
65
66 return $tests;
67
68 }
$tests
Definition: bench.php:104

References $calendar, and $tests.


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