ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
OutboxPostTest.php
Go to the documentation of this file.
1<?php
2
4
5use Sabre\HTTP;
6
8
9 protected $setupCalDAV = true;
10 protected $setupACL = true;
11 protected $autoLogin = 'user1';
12 protected $setupCalDAVScheduling = true;
13
15
17 'REQUEST_METHOD' => 'POST',
18 'REQUEST_URI' => '/notfound',
19 'HTTP_CONTENT_TYPE' => 'text/calendar',
20 ]);
21
22 $this->assertHTTPStatus(501, $req);
23
24 }
25
27
29 'REQUEST_METHOD' => 'POST',
30 'REQUEST_URI' => '/calendars/user1/outbox',
31 ]);
32
33 $this->assertHTTPStatus(501, $req);
34
35 }
36
38
40 'REQUEST_METHOD' => 'POST',
41 'REQUEST_URI' => '/calendars',
42 'HTTP_CONTENT_TYPE' => 'text/calendar',
43 ]);
44
45 $this->assertHTTPStatus(501, $req);
46
47 }
48
50
52 'REQUEST_METHOD' => 'POST',
53 'REQUEST_URI' => '/calendars/user1/outbox',
54 'HTTP_ORIGINATOR' => 'mailto:user1.sabredav@sabredav.org',
55 'HTTP_RECIPIENT' => 'mailto:user2@example.org',
56 'HTTP_CONTENT_TYPE' => 'text/calendar',
57 ]);
58 $req->setBody('foo');
59
60 $this->assertHTTPStatus(400, $req);
61
62 }
63
64 function testNoVEVENT() {
65
67 'REQUEST_METHOD' => 'POST',
68 'REQUEST_URI' => '/calendars/user1/outbox',
69 'HTTP_ORIGINATOR' => 'mailto:user1.sabredav@sabredav.org',
70 'HTTP_RECIPIENT' => 'mailto:user2@example.org',
71 'HTTP_CONTENT_TYPE' => 'text/calendar',
72 ]);
73
74 $body = [
75 'BEGIN:VCALENDAR',
76 'BEGIN:VTIMEZONE',
77 'END:VTIMEZONE',
78 'END:VCALENDAR',
79 ];
80
81 $req->setBody(implode("\r\n", $body));
82
83 $this->assertHTTPStatus(400, $req);
84
85 }
86
87 function testNoMETHOD() {
88
90 'REQUEST_METHOD' => 'POST',
91 'REQUEST_URI' => '/calendars/user1/outbox',
92 'HTTP_ORIGINATOR' => 'mailto:user1.sabredav@sabredav.org',
93 'HTTP_RECIPIENT' => 'mailto:user2@example.org',
94 'HTTP_CONTENT_TYPE' => 'text/calendar',
95 ]);
96
97 $body = [
98 'BEGIN:VCALENDAR',
99 'BEGIN:VEVENT',
100 'END:VEVENT',
101 'END:VCALENDAR',
102 ];
103
104 $req->setBody(implode("\r\n", $body));
105
106 $this->assertHTTPStatus(400, $req);
107
108 }
109
111
113 'REQUEST_METHOD' => 'POST',
114 'REQUEST_URI' => '/calendars/user1/outbox',
115 'HTTP_ORIGINATOR' => 'mailto:user1.sabredav@sabredav.org',
116 'HTTP_RECIPIENT' => 'mailto:user2@example.org',
117 'HTTP_CONTENT_TYPE' => 'text/calendar',
118 ]);
119
120 $body = [
121 'BEGIN:VCALENDAR',
122 'METHOD:PUBLISH',
123 'BEGIN:VEVENT',
124 'END:VEVENT',
125 'END:VCALENDAR',
126 ];
127
128 $req->setBody(implode("\r\n", $body));
129
130 $this->assertHTTPStatus(501, $req);
131
132 }
133
134}
An exception for terminatinating execution or to throw for unit testing.
This class may be used as a basis for other webdav-related unittests.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$req
Definition: getUserInfo.php:20