Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821177
MultiGetTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
MultiGetTest.php
View Options
<?php
namespace
Sabre\CardDAV
;
use
Sabre\HTTP
;
use
Sabre\DAV
;
require_once
'Sabre/HTTP/ResponseMock.php'
;
class
MultiGetTest
extends
AbstractPluginTest
{
function
testMultiGet
()
{
$request
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'REPORT'
,
'REQUEST_URI'
=>
'/addressbooks/user1/book1'
,
));
$request
->
setBody
(
'<?xml version="1.0"?>
<c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
<d:prop>
<d:getetag />
<c:address-data />
</d:prop>
<d:href>/addressbooks/user1/book1/card1</d:href>
</c:addressbook-multiget>'
);
$response
=
new
HTTP\ResponseMock
();
$this
->
server
->
httpRequest
=
$request
;
$this
->
server
->
httpResponse
=
$response
;
$this
->
server
->
exec
();
$this
->
assertEquals
(
207
,
$response
->
status
,
'Incorrect status code. Full response body:'
.
$response
->
body
);
// using the client for parsing
$client
=
new
DAV\Client
(
array
(
'baseUri'
=>
'/'
));
$result
=
$client
->
parseMultiStatus
(
$response
->
body
);
$this
->
assertEquals
(
array
(
'/addressbooks/user1/book1/card1'
=>
array
(
200
=>
array
(
'{DAV:}getetag'
=>
'"'
.
md5
(
"BEGIN:VCARD
\n
VERSION:3.0
\n
UID:12345
\n
END:VCARD"
)
.
'"'
,
'{urn:ietf:params:xml:ns:carddav}address-data'
=>
"BEGIN:VCARD
\r\n
VERSION:3.0
\r\n
UID:12345
\r\n
END:VCARD
\r\n
"
,
)
)
),
$result
);
}
function
testMultiGetVCard4
()
{
$request
=
HTTP\Sapi
::
createFromServerArray
(
array
(
'REQUEST_METHOD'
=>
'REPORT'
,
'REQUEST_URI'
=>
'/addressbooks/user1/book1'
,
));
$request
->
setBody
(
'<?xml version="1.0"?>
<c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
<d:prop>
<d:getetag />
<c:address-data content-type="text/vcard" version="4.0" />
</d:prop>
<d:href>/addressbooks/user1/book1/card1</d:href>
</c:addressbook-multiget>'
);
$response
=
new
HTTP\ResponseMock
();
$this
->
server
->
httpRequest
=
$request
;
$this
->
server
->
httpResponse
=
$response
;
$this
->
server
->
exec
();
$this
->
assertEquals
(
207
,
$response
->
status
,
'Incorrect status code. Full response body:'
.
$response
->
body
);
// using the client for parsing
$client
=
new
DAV\Client
(
array
(
'baseUri'
=>
'/'
));
$result
=
$client
->
parseMultiStatus
(
$response
->
body
);
$prodId
=
"PRODID:-//Sabre//Sabre VObject "
.
\Sabre\VObject\Version
::
VERSION
.
"//EN"
;
$this
->
assertEquals
(
array
(
'/addressbooks/user1/book1/card1'
=>
array
(
200
=>
array
(
'{DAV:}getetag'
=>
'"'
.
md5
(
"BEGIN:VCARD
\n
VERSION:3.0
\n
UID:12345
\n
END:VCARD"
)
.
'"'
,
'{urn:ietf:params:xml:ns:carddav}address-data'
=>
"BEGIN:VCARD
\r\n
VERSION:4.0
\r\n
$prodId
\r\n
UID:12345
\r\n
END:VCARD
\r\n
"
,
)
)
),
$result
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Dec 23, 6:44 AM (21 h, 26 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914666
Default Alt Text
MultiGetTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment