Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1812307
OutboxPostTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
3 KB
Subscribers
None
OutboxPostTest.php
View Options
<?php
namespace
Sabre\CalDAV\Schedule
;
use
Sabre\HTTP
;
use
Sabre\VObject
;
use
Sabre\DAV
;
class
OutboxPostTest
extends
\Sabre\DAVServerTest
{
protected
$setupCalDAV
=
true
;
protected
$setupACL
=
true
;
protected
$autoLogin
=
'user1'
;
protected
$setupCalDAVScheduling
=
true
;
function
testPostPassThruNotFound
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/notfound'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$this
->
assertHTTPStatus
(
501
,
$req
);
}
function
testPostPassThruNotTextCalendar
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars/user1/outbox'
,
));
$this
->
assertHTTPStatus
(
501
,
$req
);
}
function
testPostPassThruNoOutBox
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$this
->
assertHTTPStatus
(
501
,
$req
);
}
function
testInvalidIcalBody
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars/user1/outbox'
,
'HTTP_ORIGINATOR'
=>
'mailto:user1.sabredav@sabredav.org'
,
'HTTP_RECIPIENT'
=>
'mailto:user2@example.org'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$req
->
setBody
(
'foo'
);
$this
->
assertHTTPStatus
(
400
,
$req
);
}
function
testNoVEVENT
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars/user1/outbox'
,
'HTTP_ORIGINATOR'
=>
'mailto:user1.sabredav@sabredav.org'
,
'HTTP_RECIPIENT'
=>
'mailto:user2@example.org'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$body
=
array
(
'BEGIN:VCALENDAR'
,
'BEGIN:VTIMEZONE'
,
'END:VTIMEZONE'
,
'END:VCALENDAR'
,
);
$req
->
setBody
(
implode
(
"
\r\n
"
,
$body
));
$this
->
assertHTTPStatus
(
400
,
$req
);
}
function
testNoMETHOD
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars/user1/outbox'
,
'HTTP_ORIGINATOR'
=>
'mailto:user1.sabredav@sabredav.org'
,
'HTTP_RECIPIENT'
=>
'mailto:user2@example.org'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$body
=
array
(
'BEGIN:VCALENDAR'
,
'BEGIN:VEVENT'
,
'END:VEVENT'
,
'END:VCALENDAR'
,
);
$req
->
setBody
(
implode
(
"
\r\n
"
,
$body
));
$this
->
assertHTTPStatus
(
400
,
$req
);
}
function
testUnsupportedMethod
()
{
$req
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'POST'
,
'REQUEST_URI'
=>
'/calendars/user1/outbox'
,
'HTTP_ORIGINATOR'
=>
'mailto:user1.sabredav@sabredav.org'
,
'HTTP_RECIPIENT'
=>
'mailto:user2@example.org'
,
'HTTP_CONTENT_TYPE'
=>
'text/calendar'
,
));
$body
=
array
(
'BEGIN:VCALENDAR'
,
'METHOD:PUBLISH'
,
'BEGIN:VEVENT'
,
'END:VEVENT'
,
'END:VCALENDAR'
,
);
$req
->
setBody
(
implode
(
"
\r\n
"
,
$body
));
$this
->
assertHTTPStatus
(
501
,
$req
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Dec 20 2024, 5:45 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914466
Default Alt Text
OutboxPostTest.php (3 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment