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
22%foo%
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
49%foo%
50BEGIN:VEVENT
51SEQUENCE:1
52UID:foobar
53END:VEVENT
54END:VCALENDAR
55ICS;
56
57        $expected = <<<ICS
58BEGIN:VCALENDAR
59%foo%
60BEGIN:VEVENT
61SEQUENCE:2
62UID:foobar
63END:VEVENT
64END:VCALENDAR
65ICS;
66
67        $result = $this->process($itip, $old, $expected);
68
69    }
70
71    function testCancel() {
72
73        $itip = <<<ICS
74BEGIN:VCALENDAR
75VERSION:2.0
76METHOD:CANCEL
77BEGIN:VEVENT
78SEQUENCE:2
79UID:foobar
80END:VEVENT
81END:VCALENDAR
82ICS;
83
84        $old = <<<ICS
85BEGIN:VCALENDAR
86%foo%
87BEGIN:VEVENT
88SEQUENCE:1
89UID:foobar
90END:VEVENT
91END:VCALENDAR
92ICS;
93
94        $expected = <<<ICS
95BEGIN:VCALENDAR
96%foo%
97BEGIN:VEVENT
98SEQUENCE:2
99UID:foobar
100STATUS:CANCELLED
101END:VEVENT
102END:VCALENDAR
103ICS;
104
105        $result = $this->process($itip, $old, $expected);
106
107    }
108
109    function testCancelNoExistingEvent() {
110
111        $itip = <<<ICS
112BEGIN:VCALENDAR
113VERSION:2.0
114METHOD:CANCEL
115BEGIN:VEVENT
116SEQUENCE:2
117UID:foobar
118END:VEVENT
119END:VCALENDAR
120ICS;
121
122        $old = null;
123        $expected = null;
124
125        $result = $this->process($itip, $old, $expected);
126
127    }
128
129    function testUnsupportedComponent() {
130
131        $itip = <<<ICS
132BEGIN:VCALENDAR
133VERSION:2.0
134BEGIN:VTODO
135SEQUENCE:2
136UID:foobar
137END:VTODO
138END:VCALENDAR
139ICS;
140
141        $old = null;
142        $expected = null;
143
144        $result = $this->process($itip, $old, $expected);
145
146    }
147
148    function testUnsupportedMethod() {
149
150        $itip = <<<ICS
151BEGIN:VCALENDAR
152VERSION:2.0
153METHOD:PUBLISH
154BEGIN:VEVENT
155SEQUENCE:2
156UID:foobar
157END:VEVENT
158END:VCALENDAR
159ICS;
160
161        $old = null;
162        $expected = null;
163
164        $result = $this->process($itip, $old, $expected);
165
166    }
167
168}
169