1<?php 2 3namespace Sabre\VObject\ITip; 4 5class BrokerDeleteEventTest extends BrokerTester { 6 7 function testOrganizerDelete() { 8 9 $oldMessage = <<<ICS 10BEGIN:VCALENDAR 11VERSION:2.0 12BEGIN:VEVENT 13UID:foobar 14SEQUENCE:1 15SUMMARY:foo 16ORGANIZER;CN=Strunk:mailto:strunk@example.org 17ATTENDEE;CN=One:mailto:one@example.org 18ATTENDEE;CN=Two:mailto:two@example.org 19DTSTART:20140716T120000Z 20END:VEVENT 21END:VCALENDAR 22ICS; 23 24 25 $newMessage = null; 26 27 $version = \Sabre\VObject\Version::VERSION; 28 29 $expected = array( 30 array( 31 'uid' => 'foobar', 32 'method' => 'CANCEL', 33 'component' => 'VEVENT', 34 'sender' => 'mailto:strunk@example.org', 35 'senderName' => 'Strunk', 36 'recipient' => 'mailto:one@example.org', 37 'recipientName' => 'One', 38 'message' => <<<ICS 39BEGIN:VCALENDAR 40VERSION:2.0 41PRODID:-//Sabre//Sabre VObject $version//EN 42CALSCALE:GREGORIAN 43METHOD:CANCEL 44BEGIN:VEVENT 45UID:foobar 46SEQUENCE:2 47SUMMARY:foo 48DTSTART:20140716T120000Z 49ORGANIZER;CN=Strunk:mailto:strunk@example.org 50ATTENDEE;CN=One:mailto:one@example.org 51END:VEVENT 52END:VCALENDAR 53ICS 54 ), 55 56 array( 57 'uid' => 'foobar', 58 'method' => 'CANCEL', 59 'component' => 'VEVENT', 60 'sender' => 'mailto:strunk@example.org', 61 'senderName' => 'Strunk', 62 'recipient' => 'mailto:two@example.org', 63 'recipientName' => 'Two', 64 'message' => <<<ICS 65BEGIN:VCALENDAR 66VERSION:2.0 67PRODID:-//Sabre//Sabre VObject $version//EN 68CALSCALE:GREGORIAN 69METHOD:CANCEL 70BEGIN:VEVENT 71UID:foobar 72SEQUENCE:2 73SUMMARY:foo 74DTSTART:20140716T120000Z 75ORGANIZER;CN=Strunk:mailto:strunk@example.org 76ATTENDEE;CN=Two:mailto:two@example.org 77END:VEVENT 78END:VCALENDAR 79ICS 80 81 ), 82 ); 83 84 $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org'); 85 86 } 87 88 function testAttendeeDelete() { 89 90 $oldMessage = <<<ICS 91BEGIN:VCALENDAR 92VERSION:2.0 93BEGIN:VEVENT 94UID:foobar 95SEQUENCE:1 96SUMMARY:foo 97ORGANIZER;CN=Strunk:mailto:strunk@example.org 98ATTENDEE;CN=One:mailto:one@example.org 99ATTENDEE;CN=Two:mailto:two@example.org 100DTSTART:20140716T120000Z 101END:VEVENT 102END:VCALENDAR 103ICS; 104 105 106 $newMessage = null; 107 108 $version = \Sabre\VObject\Version::VERSION; 109 110 $expected = array( 111 array( 112 'uid' => 'foobar', 113 'method' => 'REPLY', 114 'component' => 'VEVENT', 115 'sender' => 'mailto:one@example.org', 116 'senderName' => 'One', 117 'recipient' => 'mailto:strunk@example.org', 118 'recipientName' => 'Strunk', 119 'message' => <<<ICS 120BEGIN:VCALENDAR 121VERSION:2.0 122PRODID:-//Sabre//Sabre VObject $version//EN 123CALSCALE:GREGORIAN 124METHOD:REPLY 125BEGIN:VEVENT 126UID:foobar 127SEQUENCE:1 128DTSTART:20140716T120000Z 129SUMMARY:foo 130ORGANIZER;CN=Strunk:mailto:strunk@example.org 131ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one@example.org 132END:VEVENT 133END:VCALENDAR 134ICS 135 ), 136 ); 137 138 $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:one@example.org'); 139 140 141 } 142 143 function testAttendeeDeleteCancelledEvent() { 144 145 $oldMessage = <<<ICS 146BEGIN:VCALENDAR 147VERSION:2.0 148BEGIN:VEVENT 149STATUS:CANCELLED 150UID:foobar 151SEQUENCE:1 152ORGANIZER;CN=Strunk:mailto:strunk@example.org 153ATTENDEE;CN=One:mailto:one@example.org 154ATTENDEE;CN=Two:mailto:two@example.org 155DTSTART:20140716T120000Z 156END:VEVENT 157END:VCALENDAR 158ICS; 159 160 161 $newMessage = null; 162 163 $version = \Sabre\VObject\Version::VERSION; 164 165 $expected = array(); 166 167 $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:one@example.org'); 168 169 170 } 171 172 function testNoCalendar() { 173 174 $this->parse(null, null, array(), 'mailto:one@example.org'); 175 176 } 177 178 function testVTodo() { 179 180 $oldMessage = <<<ICS 181BEGIN:VCALENDAR 182VERSION:2.0 183BEGIN:VTODO 184UID:foobar 185SEQUENCE:1 186END:VTODO 187END:VCALENDAR 188ICS; 189 $this->parse($oldMessage, null, array(), 'mailto:one@example.org'); 190 191 } 192 193} 194