BrokerUpdateEventTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <?php
  2. namespace Sabre\VObject\ITip;
  3. class BrokerUpdateTest extends BrokerTester {
  4. function testInviteChange() {
  5. $oldMessage = <<<ICS
  6. BEGIN:VCALENDAR
  7. VERSION:2.0
  8. BEGIN:VEVENT
  9. UID:foobar
  10. SEQUENCE:1
  11. SUMMARY:foo
  12. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  13. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  14. ATTENDEE;CN=One:mailto:one@example.org
  15. ATTENDEE;CN=Two:mailto:two@example.org
  16. DTSTART:20140716T120000Z
  17. DTEND:20140716T130000Z
  18. END:VEVENT
  19. END:VCALENDAR
  20. ICS;
  21. $newMessage = <<<ICS
  22. BEGIN:VCALENDAR
  23. VERSION:2.0
  24. BEGIN:VEVENT
  25. UID:foobar
  26. SEQUENCE:2
  27. SUMMARY:foo
  28. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  29. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  30. ATTENDEE;CN=Two:mailto:two@example.org
  31. ATTENDEE;CN=Three:mailto:three@example.org
  32. DTSTART:20140716T120000Z
  33. DTEND:20140716T130000Z
  34. END:VEVENT
  35. END:VCALENDAR
  36. ICS;
  37. $version = \Sabre\VObject\Version::VERSION;
  38. $expected = array(
  39. array(
  40. 'uid' => 'foobar',
  41. 'method' => 'CANCEL',
  42. 'component' => 'VEVENT',
  43. 'sender' => 'mailto:strunk@example.org',
  44. 'senderName' => 'Strunk',
  45. 'recipient' => 'mailto:one@example.org',
  46. 'recipientName' => 'One',
  47. 'significantChange' => true,
  48. 'message' => <<<ICS
  49. BEGIN:VCALENDAR
  50. VERSION:2.0
  51. PRODID:-//Sabre//Sabre VObject $version//EN
  52. CALSCALE:GREGORIAN
  53. METHOD:CANCEL
  54. BEGIN:VEVENT
  55. UID:foobar
  56. SEQUENCE:2
  57. SUMMARY:foo
  58. DTSTART:20140716T120000Z
  59. DTEND:20140716T130000Z
  60. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  61. ATTENDEE;CN=One:mailto:one@example.org
  62. END:VEVENT
  63. END:VCALENDAR
  64. ICS
  65. ),
  66. array(
  67. 'uid' => 'foobar',
  68. 'method' => 'REQUEST',
  69. 'component' => 'VEVENT',
  70. 'sender' => 'mailto:strunk@example.org',
  71. 'senderName' => 'Strunk',
  72. 'recipient' => 'mailto:two@example.org',
  73. 'recipientName' => 'Two',
  74. 'significantChange' => false,
  75. 'message' => <<<ICS
  76. BEGIN:VCALENDAR
  77. VERSION:2.0
  78. PRODID:-//Sabre//Sabre VObject $version//EN
  79. CALSCALE:GREGORIAN
  80. METHOD:REQUEST
  81. BEGIN:VEVENT
  82. UID:foobar
  83. SEQUENCE:2
  84. SUMMARY:foo
  85. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  86. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  87. ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
  88. ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
  89. DTSTART:20140716T120000Z
  90. DTEND:20140716T130000Z
  91. END:VEVENT
  92. END:VCALENDAR
  93. ICS
  94. ),
  95. array(
  96. 'uid' => 'foobar',
  97. 'method' => 'REQUEST',
  98. 'component' => 'VEVENT',
  99. 'sender' => 'mailto:strunk@example.org',
  100. 'senderName' => 'Strunk',
  101. 'recipient' => 'mailto:three@example.org',
  102. 'recipientName' => 'Three',
  103. 'significantChange' => true,
  104. 'message' => <<<ICS
  105. BEGIN:VCALENDAR
  106. VERSION:2.0
  107. PRODID:-//Sabre//Sabre VObject $version//EN
  108. CALSCALE:GREGORIAN
  109. METHOD:REQUEST
  110. BEGIN:VEVENT
  111. UID:foobar
  112. SEQUENCE:2
  113. SUMMARY:foo
  114. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  115. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  116. ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
  117. ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
  118. DTSTART:20140716T120000Z
  119. DTEND:20140716T130000Z
  120. END:VEVENT
  121. END:VCALENDAR
  122. ICS
  123. ),
  124. );
  125. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  126. }
  127. function testInviteChangeFromNonSchedulingToSchedulingObject() {
  128. $oldMessage = <<<ICS
  129. BEGIN:VCALENDAR
  130. VERSION:2.0
  131. BEGIN:VEVENT
  132. UID:foobar
  133. SEQUENCE:1
  134. DTSTART:20140716T120000Z
  135. DTEND:20140716T130000Z
  136. END:VEVENT
  137. END:VCALENDAR
  138. ICS;
  139. $newMessage = <<<ICS
  140. BEGIN:VCALENDAR
  141. VERSION:2.0
  142. BEGIN:VEVENT
  143. UID:foobar
  144. SEQUENCE:2
  145. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  146. ATTENDEE;CN=One:mailto:one@example.org
  147. DTSTART:20140716T120000Z
  148. DTEND:20140716T130000Z
  149. END:VEVENT
  150. END:VCALENDAR
  151. ICS;
  152. $version = \Sabre\VObject\Version::VERSION;
  153. $expected = array(
  154. array(
  155. 'uid' => 'foobar',
  156. 'method' => 'REQUEST',
  157. 'component' => 'VEVENT',
  158. 'sender' => 'mailto:strunk@example.org',
  159. 'senderName' => 'Strunk',
  160. 'recipient' => 'mailto:one@example.org',
  161. 'recipientName' => 'One',
  162. 'message' => <<<ICS
  163. BEGIN:VCALENDAR
  164. VERSION:2.0
  165. PRODID:-//Sabre//Sabre VObject $version//EN
  166. CALSCALE:GREGORIAN
  167. METHOD:REQUEST
  168. BEGIN:VEVENT
  169. UID:foobar
  170. SEQUENCE:2
  171. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  172. ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
  173. DTSTART:20140716T120000Z
  174. DTEND:20140716T130000Z
  175. END:VEVENT
  176. END:VCALENDAR
  177. ICS
  178. ),
  179. );
  180. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  181. }
  182. function testInviteChangeFromSchedulingToNonSchedulingObject() {
  183. $oldMessage = <<<ICS
  184. BEGIN:VCALENDAR
  185. VERSION:2.0
  186. BEGIN:VEVENT
  187. UID:foobar
  188. SEQUENCE:2
  189. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  190. ATTENDEE;CN=One:mailto:one@example.org
  191. DTSTART:20140716T120000Z
  192. DTEND:20140716T130000Z
  193. END:VEVENT
  194. END:VCALENDAR
  195. ICS;
  196. $newMessage = <<<ICS
  197. BEGIN:VCALENDAR
  198. VERSION:2.0
  199. BEGIN:VEVENT
  200. UID:foobar
  201. SEQUENCE:1
  202. DTSTART:20140716T120000Z
  203. DTEND:20140716T130000Z
  204. END:VEVENT
  205. END:VCALENDAR
  206. ICS;
  207. $version = \Sabre\VObject\Version::VERSION;
  208. $expected = array(
  209. array(
  210. 'uid' => 'foobar',
  211. 'method' => 'CANCEL',
  212. 'component' => 'VEVENT',
  213. 'message' => <<<ICS
  214. BEGIN:VCALENDAR
  215. VERSION:2.0
  216. PRODID:-//Sabre//Sabre VObject $version//EN
  217. CALSCALE:GREGORIAN
  218. METHOD:CANCEL
  219. BEGIN:VEVENT
  220. UID:foobar
  221. SEQUENCE:1
  222. DTSTART:20140716T120000Z
  223. DTEND:20140716T130000Z
  224. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  225. ATTENDEE;CN=One:mailto:one@example.org
  226. END:VEVENT
  227. END:VCALENDAR
  228. ICS
  229. ),
  230. );
  231. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  232. }
  233. function testNoAttendees() {
  234. $oldMessage = <<<ICS
  235. BEGIN:VCALENDAR
  236. VERSION:2.0
  237. BEGIN:VEVENT
  238. UID:foobar
  239. SEQUENCE:1
  240. DTSTART:20140716T120000Z
  241. DTEND:20140716T130000Z
  242. END:VEVENT
  243. END:VCALENDAR
  244. ICS;
  245. $newMessage = <<<ICS
  246. BEGIN:VCALENDAR
  247. VERSION:2.0
  248. BEGIN:VEVENT
  249. UID:foobar
  250. SEQUENCE:2
  251. DTSTART:20140716T120000Z
  252. DTEND:20140716T130000Z
  253. END:VEVENT
  254. END:VCALENDAR
  255. ICS;
  256. $version = \Sabre\VObject\Version::VERSION;
  257. $expected = array();
  258. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  259. }
  260. function testRemoveInstance() {
  261. $oldMessage = <<<ICS
  262. BEGIN:VCALENDAR
  263. VERSION:2.0
  264. BEGIN:VEVENT
  265. UID:foobar
  266. SEQUENCE:1
  267. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  268. ATTENDEE;CN=One:mailto:one@example.org
  269. DTSTART;TZID=America/Toronto:20140716T120000
  270. DTEND;TZID=America/Toronto:20140716T130000
  271. RRULE:FREQ=WEEKLY
  272. END:VEVENT
  273. END:VCALENDAR
  274. ICS;
  275. $newMessage = <<<ICS
  276. BEGIN:VCALENDAR
  277. VERSION:2.0
  278. BEGIN:VEVENT
  279. UID:foobar
  280. SEQUENCE:2
  281. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  282. ATTENDEE;CN=One:mailto:one@example.org
  283. DTSTART;TZID=America/Toronto:20140716T120000
  284. DTEND;TZID=America/Toronto:20140716T130000
  285. RRULE:FREQ=WEEKLY
  286. EXDATE;TZID=America/Toronto:20140724T120000
  287. END:VEVENT
  288. END:VCALENDAR
  289. ICS;
  290. $version = \Sabre\VObject\Version::VERSION;
  291. $expected = array(
  292. array(
  293. 'uid' => 'foobar',
  294. 'method' => 'REQUEST',
  295. 'component' => 'VEVENT',
  296. 'sender' => 'mailto:strunk@example.org',
  297. 'senderName' => 'Strunk',
  298. 'recipient' => 'mailto:one@example.org',
  299. 'recipientName' => 'One',
  300. 'message' => <<<ICS
  301. BEGIN:VCALENDAR
  302. VERSION:2.0
  303. PRODID:-//Sabre//Sabre VObject $version//EN
  304. CALSCALE:GREGORIAN
  305. METHOD:REQUEST
  306. BEGIN:VEVENT
  307. UID:foobar
  308. SEQUENCE:2
  309. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  310. ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
  311. DTSTART;TZID=America/Toronto:20140716T120000
  312. DTEND;TZID=America/Toronto:20140716T130000
  313. RRULE:FREQ=WEEKLY
  314. EXDATE;TZID=America/Toronto:20140724T120000
  315. END:VEVENT
  316. END:VCALENDAR
  317. ICS
  318. ),
  319. );
  320. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  321. }
  322. /**
  323. * This test is identical to the first test, except this time we change the
  324. * DURATION property.
  325. *
  326. * This should ensure that the message is significant for every attendee,
  327. */
  328. function testInviteChangeSignificantChange() {
  329. $oldMessage = <<<ICS
  330. BEGIN:VCALENDAR
  331. VERSION:2.0
  332. BEGIN:VEVENT
  333. UID:foobar
  334. DURATION:PT1H
  335. SEQUENCE:1
  336. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  337. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  338. ATTENDEE;CN=One:mailto:one@example.org
  339. ATTENDEE;CN=Two:mailto:two@example.org
  340. DTSTART:20140716T120000Z
  341. DTEND:20140716T130000Z
  342. END:VEVENT
  343. END:VCALENDAR
  344. ICS;
  345. $newMessage = <<<ICS
  346. BEGIN:VCALENDAR
  347. VERSION:2.0
  348. BEGIN:VEVENT
  349. UID:foobar
  350. DURATION:PT2H
  351. SEQUENCE:2
  352. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  353. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  354. ATTENDEE;CN=Two:mailto:two@example.org
  355. ATTENDEE;CN=Three:mailto:three@example.org
  356. DTSTART:20140716T120000Z
  357. DTEND:20140716T130000Z
  358. END:VEVENT
  359. END:VCALENDAR
  360. ICS;
  361. $version = \Sabre\VObject\Version::VERSION;
  362. $expected = array(
  363. array(
  364. 'uid' => 'foobar',
  365. 'method' => 'CANCEL',
  366. 'component' => 'VEVENT',
  367. 'sender' => 'mailto:strunk@example.org',
  368. 'senderName' => 'Strunk',
  369. 'recipient' => 'mailto:one@example.org',
  370. 'recipientName' => 'One',
  371. 'significantChange' => true,
  372. 'message' => <<<ICS
  373. BEGIN:VCALENDAR
  374. VERSION:2.0
  375. PRODID:-//Sabre//Sabre VObject $version//EN
  376. CALSCALE:GREGORIAN
  377. METHOD:CANCEL
  378. BEGIN:VEVENT
  379. UID:foobar
  380. SEQUENCE:2
  381. DTSTART:20140716T120000Z
  382. DTEND:20140716T130000Z
  383. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  384. ATTENDEE;CN=One:mailto:one@example.org
  385. END:VEVENT
  386. END:VCALENDAR
  387. ICS
  388. ),
  389. array(
  390. 'uid' => 'foobar',
  391. 'method' => 'REQUEST',
  392. 'component' => 'VEVENT',
  393. 'sender' => 'mailto:strunk@example.org',
  394. 'senderName' => 'Strunk',
  395. 'recipient' => 'mailto:two@example.org',
  396. 'recipientName' => 'Two',
  397. 'significantChange' => true,
  398. 'message' => <<<ICS
  399. BEGIN:VCALENDAR
  400. VERSION:2.0
  401. PRODID:-//Sabre//Sabre VObject $version//EN
  402. CALSCALE:GREGORIAN
  403. METHOD:REQUEST
  404. BEGIN:VEVENT
  405. UID:foobar
  406. DURATION:PT2H
  407. SEQUENCE:2
  408. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  409. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  410. ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
  411. ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
  412. DTSTART:20140716T120000Z
  413. DTEND:20140716T130000Z
  414. END:VEVENT
  415. END:VCALENDAR
  416. ICS
  417. ),
  418. array(
  419. 'uid' => 'foobar',
  420. 'method' => 'REQUEST',
  421. 'component' => 'VEVENT',
  422. 'sender' => 'mailto:strunk@example.org',
  423. 'senderName' => 'Strunk',
  424. 'recipient' => 'mailto:three@example.org',
  425. 'recipientName' => 'Three',
  426. 'significantChange' => true,
  427. 'message' => <<<ICS
  428. BEGIN:VCALENDAR
  429. VERSION:2.0
  430. PRODID:-//Sabre//Sabre VObject $version//EN
  431. CALSCALE:GREGORIAN
  432. METHOD:REQUEST
  433. BEGIN:VEVENT
  434. UID:foobar
  435. DURATION:PT2H
  436. SEQUENCE:2
  437. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  438. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  439. ATTENDEE;CN=Two;PARTSTAT=NEEDS-ACTION:mailto:two@example.org
  440. ATTENDEE;CN=Three;PARTSTAT=NEEDS-ACTION:mailto:three@example.org
  441. DTSTART:20140716T120000Z
  442. DTEND:20140716T130000Z
  443. END:VEVENT
  444. END:VCALENDAR
  445. ICS
  446. ),
  447. );
  448. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  449. }
  450. function testInviteNoChange() {
  451. $oldMessage = <<<ICS
  452. BEGIN:VCALENDAR
  453. VERSION:2.0
  454. BEGIN:VEVENT
  455. UID:foobar
  456. SEQUENCE:1
  457. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  458. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  459. ATTENDEE;CN=One:mailto:one@example.org
  460. DTSTART:20140716T120000Z
  461. DTEND:20140716T130000Z
  462. END:VEVENT
  463. END:VCALENDAR
  464. ICS;
  465. $newMessage = <<<ICS
  466. BEGIN:VCALENDAR
  467. VERSION:2.0
  468. BEGIN:VEVENT
  469. UID:foobar
  470. SEQUENCE:2
  471. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  472. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  473. ATTENDEE;CN=One:mailto:one@example.org
  474. DTSTART:20140716T120000Z
  475. DTEND:20140716T130000Z
  476. END:VEVENT
  477. END:VCALENDAR
  478. ICS;
  479. $version = \Sabre\VObject\Version::VERSION;
  480. $expected = array(
  481. array(
  482. 'uid' => 'foobar',
  483. 'method' => 'REQUEST',
  484. 'component' => 'VEVENT',
  485. 'sender' => 'mailto:strunk@example.org',
  486. 'senderName' => 'Strunk',
  487. 'recipient' => 'mailto:one@example.org',
  488. 'recipientName' => 'One',
  489. 'significantChange' => false,
  490. 'message' => <<<ICS
  491. BEGIN:VCALENDAR
  492. VERSION:2.0
  493. PRODID:-//Sabre//Sabre VObject $version//EN
  494. CALSCALE:GREGORIAN
  495. METHOD:REQUEST
  496. BEGIN:VEVENT
  497. UID:foobar
  498. SEQUENCE:2
  499. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  500. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  501. ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
  502. DTSTART:20140716T120000Z
  503. DTEND:20140716T130000Z
  504. END:VEVENT
  505. END:VCALENDAR
  506. ICS
  507. ),
  508. );
  509. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  510. }
  511. function testInviteNoChangeForceSend() {
  512. $oldMessage = <<<ICS
  513. BEGIN:VCALENDAR
  514. VERSION:2.0
  515. BEGIN:VEVENT
  516. UID:foobar
  517. SEQUENCE:1
  518. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  519. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  520. ATTENDEE;CN=One:mailto:one@example.org
  521. DTSTART:20140716T120000Z
  522. DTEND:20140716T130000Z
  523. END:VEVENT
  524. END:VCALENDAR
  525. ICS;
  526. $newMessage = <<<ICS
  527. BEGIN:VCALENDAR
  528. VERSION:2.0
  529. BEGIN:VEVENT
  530. UID:foobar
  531. SEQUENCE:2
  532. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  533. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  534. ATTENDEE;SCHEDULE-FORCE-SEND=REQUEST;CN=One:mailto:one@example.org
  535. DTSTART:20140716T120000Z
  536. DTEND:20140716T130000Z
  537. END:VEVENT
  538. END:VCALENDAR
  539. ICS;
  540. $version = \Sabre\VObject\Version::VERSION;
  541. $expected = array(
  542. array(
  543. 'uid' => 'foobar',
  544. 'method' => 'REQUEST',
  545. 'component' => 'VEVENT',
  546. 'sender' => 'mailto:strunk@example.org',
  547. 'senderName' => 'Strunk',
  548. 'recipient' => 'mailto:one@example.org',
  549. 'recipientName' => 'One',
  550. 'significantChange' => true,
  551. 'message' => <<<ICS
  552. BEGIN:VCALENDAR
  553. VERSION:2.0
  554. PRODID:-//Sabre//Sabre VObject $version//EN
  555. CALSCALE:GREGORIAN
  556. METHOD:REQUEST
  557. BEGIN:VEVENT
  558. UID:foobar
  559. SEQUENCE:2
  560. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  561. ATTENDEE;CN=Strunk;PARTSTAT=ACCEPTED:mailto:strunk@example.org
  562. ATTENDEE;CN=One;PARTSTAT=NEEDS-ACTION:mailto:one@example.org
  563. DTSTART:20140716T120000Z
  564. DTEND:20140716T130000Z
  565. END:VEVENT
  566. END:VCALENDAR
  567. ICS
  568. ),
  569. );
  570. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  571. }
  572. function testInviteRemoveAttendees() {
  573. $oldMessage = <<<ICS
  574. BEGIN:VCALENDAR
  575. VERSION:2.0
  576. BEGIN:VEVENT
  577. UID:foobar
  578. SEQUENCE:1
  579. SUMMARY:foo
  580. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  581. ATTENDEE;CN=Strunk:mailto:strunk@example.org
  582. ATTENDEE;CN=One:mailto:one@example.org
  583. ATTENDEE;CN=Two:mailto:two@example.org
  584. DTSTART:20140716T120000Z
  585. DTEND:20140716T130000Z
  586. END:VEVENT
  587. END:VCALENDAR
  588. ICS;
  589. $newMessage = <<<ICS
  590. BEGIN:VCALENDAR
  591. VERSION:2.0
  592. BEGIN:VEVENT
  593. UID:foobar
  594. SEQUENCE:2
  595. SUMMARY:foo
  596. DTSTART:20140716T120000Z
  597. DTEND:20140716T130000Z
  598. END:VEVENT
  599. END:VCALENDAR
  600. ICS;
  601. $version = \Sabre\VObject\Version::VERSION;
  602. $expected = array(
  603. array(
  604. 'uid' => 'foobar',
  605. 'method' => 'CANCEL',
  606. 'component' => 'VEVENT',
  607. 'sender' => 'mailto:strunk@example.org',
  608. 'senderName' => 'Strunk',
  609. 'recipient' => 'mailto:one@example.org',
  610. 'recipientName' => 'One',
  611. 'significantChange' => true,
  612. 'message' => <<<ICS
  613. BEGIN:VCALENDAR
  614. VERSION:2.0
  615. PRODID:-//Sabre//Sabre VObject $version//EN
  616. CALSCALE:GREGORIAN
  617. METHOD:CANCEL
  618. BEGIN:VEVENT
  619. UID:foobar
  620. SEQUENCE:2
  621. SUMMARY:foo
  622. DTSTART:20140716T120000Z
  623. DTEND:20140716T130000Z
  624. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  625. ATTENDEE;CN=One:mailto:one@example.org
  626. END:VEVENT
  627. END:VCALENDAR
  628. ICS
  629. ),
  630. array(
  631. 'uid' => 'foobar',
  632. 'method' => 'CANCEL',
  633. 'component' => 'VEVENT',
  634. 'sender' => 'mailto:strunk@example.org',
  635. 'senderName' => 'Strunk',
  636. 'recipient' => 'mailto:two@example.org',
  637. 'recipientName' => 'Two',
  638. 'significantChange' => true,
  639. 'message' => <<<ICS
  640. BEGIN:VCALENDAR
  641. VERSION:2.0
  642. PRODID:-//Sabre//Sabre VObject $version//EN
  643. CALSCALE:GREGORIAN
  644. METHOD:CANCEL
  645. BEGIN:VEVENT
  646. UID:foobar
  647. SEQUENCE:2
  648. SUMMARY:foo
  649. DTSTART:20140716T120000Z
  650. DTEND:20140716T130000Z
  651. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  652. ATTENDEE;CN=Two:mailto:two@example.org
  653. END:VEVENT
  654. END:VCALENDAR
  655. ICS
  656. ),
  657. );
  658. $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  659. }
  660. function testInviteChangeExdateOrder() {
  661. $oldMessage = <<<ICS
  662. BEGIN:VCALENDAR
  663. VERSION:2.0
  664. PRODID:-//Apple Inc.//Mac OS X 10.10.1//EN
  665. CALSCALE:GREGORIAN
  666. BEGIN:VEVENT
  667. UID:foobar
  668. SEQUENCE:0
  669. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  670. ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
  671. PTED:mailto:strunk@example.org
  672. ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
  673. OLE=REQ-PARTICIPANT;SCHEDULE-STATUS="1.2;Message delivered locally":mailto
  674. :one@example.org
  675. SUMMARY:foo
  676. DTSTART:20141211T160000Z
  677. DTEND:20141211T170000Z
  678. RRULE:FREQ=WEEKLY
  679. EXDATE:20141225T160000Z,20150101T160000Z
  680. EXDATE:20150108T160000Z
  681. END:VEVENT
  682. END:VCALENDAR
  683. ICS;
  684. $newMessage = <<<ICS
  685. BEGIN:VCALENDAR
  686. VERSION:2.0
  687. PRODID:-//Apple Inc.//Mac OS X 10.10.1//EN
  688. CALSCALE:GREGORIAN
  689. BEGIN:VEVENT
  690. UID:foobar
  691. SEQUENCE:1
  692. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  693. ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
  694. PTED:mailto:strunk@example.org
  695. ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
  696. OLE=REQ-PARTICIPANT;SCHEDULE-STATUS=1.2:mailto:one@example.org
  697. DTSTART:20141211T160000Z
  698. DTEND:20141211T170000Z
  699. RRULE:FREQ=WEEKLY
  700. EXDATE:20150101T160000Z
  701. EXDATE:20150108T160000Z,20141225T160000Z
  702. END:VEVENT
  703. END:VCALENDAR
  704. ICS;
  705. $version = \Sabre\VObject\Version::VERSION;
  706. $expected = array(
  707. array(
  708. 'uid' => 'foobar',
  709. 'method' => 'REQUEST',
  710. 'component' => 'VEVENT',
  711. 'sender' => 'mailto:strunk@example.org',
  712. 'senderName' => 'Strunk',
  713. 'recipient' => 'mailto:one@example.org',
  714. 'recipientName' => 'One',
  715. 'significantChange' => false,
  716. 'message' => <<<ICS
  717. BEGIN:VCALENDAR
  718. VERSION:2.0
  719. PRODID:-//Sabre//Sabre VObject $version//EN
  720. CALSCALE:GREGORIAN
  721. METHOD:REQUEST
  722. BEGIN:VEVENT
  723. UID:foobar
  724. SEQUENCE:1
  725. ORGANIZER;CN=Strunk:mailto:strunk@example.org
  726. ATTENDEE;CN=Strunk;CUTYPE=INDIVIDUAL;EMAIL=strunk@example.org;PARTSTAT=ACCE
  727. PTED:mailto:strunk@example.org
  728. ATTENDEE;CN=One;CUTYPE=INDIVIDUAL;EMAIL=one@example.org;PARTSTAT=ACCEPTED;R
  729. OLE=REQ-PARTICIPANT:mailto:one@example.org
  730. DTSTART:20141211T160000Z
  731. DTEND:20141211T170000Z
  732. RRULE:FREQ=WEEKLY
  733. EXDATE:20150101T160000Z
  734. EXDATE:20150108T160000Z,20141225T160000Z
  735. END:VEVENT
  736. END:VCALENDAR
  737. ICS
  738. ),
  739. );
  740. $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk@example.org');
  741. }
  742. }