ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DeliverNewEventTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\CalDAV\Schedule;
4 
6 use Sabre\VObject;
7 
9 
10  public $setupCalDAV = true;
11  public $setupCalDAVScheduling = true;
12  public $setupACL = true;
13  public $autoLogin = 'user1';
14 
15  function setUp() {
16 
17  parent::setUp();
18  $this->caldavBackend->createCalendar(
19  'principals/user1',
20  'default',
21  [
22 
23  ]
24  );
25  $this->caldavBackend->createCalendar(
26  'principals/user2',
27  'default',
28  [
29 
30  ]
31  );
32 
33  }
34 
35  function testDelivery() {
36 
37  $request = new Request('PUT', '/calendars/user1/default/foo.ics');
38  $request->setBody(<<<ICS
39 BEGIN:VCALENDAR
40 VERSION:2.0
41 PRODID:-//Apple Inc.//Mac OS X 10.9.1//EN
42 CALSCALE:GREGORIAN
43 BEGIN:VEVENT
44 CREATED:20140109T204404Z
45 UID:AADC6438-18CF-4B52-8DD2-EF9AD75ADE83
46 DTEND;TZID=America/Toronto:20140107T110000
47 TRANSP:OPAQUE
48 ATTENDEE;CN="Administrator";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:user1.sabredav@sabredav.org
49 ATTENDEE;CN="Roxy Kesh";CUTYPE=INDIVIDUAL;EMAIL="user2.sabredav@sabrdav.org";
50  PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:user2.sabredav@sabredav.org
51 SUMMARY:Just testing!
52 DTSTART;TZID=America/Toronto:20140107T100000
53 DTSTAMP:20140109T204422Z
54 ORGANIZER;CN="Administrator":mailto:user1.sabredav@sabredav.org
55 SEQUENCE:4
56 END:VEVENT
57 END:VCALENDAR
58 ICS
59  );
60 
61  $messages = [];
62  $this->server->on('schedule', function($message) use (&$messages) {
63  $messages[] = $message;
64  });
65 
66  $response = $this->request($request);
67 
68  $this->assertEquals(201, $response->getStatus(), 'Incorrect status code received. Response body:' . $response->getBodyAsString());
69 
70  $result = $this->request(new Request('GET', '/calendars/user1/default/foo.ics'))->getBody();
71  $resultVObj = VObject\Reader::read($result);
72 
73  $this->assertEquals(
74  '1.2',
75  $resultVObj->VEVENT->ATTENDEE[1]['SCHEDULE-STATUS']->getValue()
76  );
77 
78  $this->assertEquals(1, count($messages));
79  $message = $messages[0];
80 
81  $this->assertInstanceOf('\Sabre\VObject\ITip\Message', $message);
82  $this->assertEquals('mailto:user2.sabredav@sabredav.org', $message->recipient);
83  $this->assertEquals('Roxy Kesh', $message->recipientName);
84  $this->assertEquals('mailto:user1.sabredav@sabredav.org', $message->sender);
85  $this->assertEquals('Administrator', $message->senderName);
86  $this->assertEquals('REQUEST', $message->method);
87 
88  $this->assertEquals('REQUEST', $message->message->METHOD->getValue());
89 
90  }
91 
92 }
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
The Request class represents a single HTTP request.
Definition: Request.php:18
$messages
Definition: en.php:5
catch(Exception $e) $message
This class may be used as a basis for other webdav-related unittests.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
user2
Definition: basicauth.php:12