1<?php
2
3namespace Sabre\VObject\ITip;
4
5class BrokerProcessMessageTest extends BrokerTester {
6
7    function testRequestNew() {
8
9        $itip = <<<ICS
10BEGIN:VCALENDAR
11VERSION:2.0
12METHOD:REQUEST
13BEGIN:VEVENT
14SEQUENCE:1
15UID:foobar
16END:VEVENT
17END:VCALENDAR
18ICS;
19
20        $expected = <<<ICS
21BEGIN:VCALENDAR
22VERSION:2.0
23BEGIN:VEVENT
24SEQUENCE:1
25UID:foobar
26END:VEVENT
27END:VCALENDAR
28ICS;
29
30        $result = $this->process($itip, null, $expected);
31
32    }
33
34    function testRequestUpdate() {
35
36        $itip = <<<ICS
37BEGIN:VCALENDAR
38VERSION:2.0
39METHOD:REQUEST
40BEGIN:VEVENT
41SEQUENCE:2
42UID:foobar
43END:VEVENT
44END:VCALENDAR
45ICS;
46
47        $old = <<<ICS
48BEGIN:VCALENDAR
49BEGIN:VEVENT
50SEQUENCE:1
51UID:foobar
52END:VEVENT
53END:VCALENDAR
54ICS;
55
56        $expected = <<<ICS
57BEGIN:VCALENDAR
58BEGIN:VEVENT
59SEQUENCE:2
60UID:foobar
61END:VEVENT
62END:VCALENDAR
63ICS;
64
65        $result = $this->process($itip, $old, $expected);
66
67    }
68
69    function testCancel() {
70
71        $itip = <<<ICS
72BEGIN:VCALENDAR
73VERSION:2.0
74METHOD:CANCEL
75BEGIN:VEVENT
76SEQUENCE:2
77UID:foobar
78END:VEVENT
79END:VCALENDAR
80ICS;
81
82        $old = <<<ICS
83BEGIN:VCALENDAR
84BEGIN:VEVENT
85SEQUENCE:1
86UID:foobar
87END:VEVENT
88END:VCALENDAR
89ICS;
90
91        $expected = <<<ICS
92BEGIN:VCALENDAR
93BEGIN:VEVENT
94UID:foobar
95STATUS:CANCELLED
96SEQUENCE:2
97END:VEVENT
98END:VCALENDAR
99ICS;
100
101        $result = $this->process($itip, $old, $expected);
102
103    }
104
105    function testCancelNoExistingEvent() {
106
107        $itip = <<<ICS
108BEGIN:VCALENDAR
109VERSION:2.0
110METHOD:CANCEL
111BEGIN:VEVENT
112SEQUENCE:2
113UID:foobar
114END:VEVENT
115END:VCALENDAR
116ICS;
117
118        $old = null;
119        $expected = null;
120
121        $result = $this->process($itip, $old, $expected);
122
123    }
124
125    function testUnsupportedComponent() {
126
127        $itip = <<<ICS
128BEGIN:VCALENDAR
129VERSION:2.0
130BEGIN:VTODO
131SEQUENCE:2
132UID:foobar
133END:VTODO
134END:VCALENDAR
135ICS;
136
137        $old = null;
138        $expected = null;
139
140        $result = $this->process($itip, $old, $expected);
141
142    }
143
144    function testUnsupportedMethod() {
145
146        $itip = <<<ICS
147BEGIN:VCALENDAR
148VERSION:2.0
149METHOD:PUBLISH
150BEGIN:VEVENT
151SEQUENCE:2
152UID:foobar
153END:VEVENT
154END:VCALENDAR
155ICS;
156
157        $old = null;
158        $expected = null;
159
160        $result = $this->process($itip, $old, $expected);
161
162    }
163
164}
165