8 require_once
'Sabre/CardDAV/AbstractPluginTest.php';
9 require_once
'Sabre/HTTP/ResponseMock.php';
17 '/addressbooks/user1/book1',
22 '<?xml version="1.0"?> 23 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 28 <c:prop-filter name="uid" /> 30 </c:addressbook-query>' 35 $this->server->httpRequest =
$request;
38 $this->server->exec();
40 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
48 '/addressbooks/user1/book1/card1' => [
50 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") .
'"',
53 '/addressbooks/user1/book1/card2' => [
55 '{DAV:}getetag' => null,
67 '/addressbooks/user1/book1/card1',
72 '<?xml version="1.0"?> 73 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 78 <c:prop-filter name="uid" /> 80 </c:addressbook-query>' 85 $this->server->httpRequest =
$request;
88 $this->server->exec();
90 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
98 '/addressbooks/user1/book1/card1' => [
100 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") .
'"',
112 '/addressbooks/user1/book1',
117 '<?xml version="1.0"?> 118 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 123 <c:prop-filter name="email" /> 125 </c:addressbook-query>' 130 $this->server->httpRequest =
$request;
133 $this->server->exec();
135 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
142 $this->assertEquals([],
$result);
149 'REQUEST_METHOD' =>
'REPORT',
150 'REQUEST_URI' =>
'/addressbooks/user1/book1',
155 '<?xml version="1.0"?> 156 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 161 <c:prop-filter name="uid" /> 163 <c:limit><c:nresults>1</c:nresults></c:limit> 164 </c:addressbook-query>' 169 $this->server->httpRequest =
$request;
172 $this->server->exec();
174 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
181 $this->assertEquals([
182 '/addressbooks/user1/book1/card1' => [
184 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") .
'"',
196 '/addressbooks/user1/book1/card1',
201 '<?xml version="1.0"?> 202 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 204 <c:address-data content-type="application/vcard+json" /> 207 </c:addressbook-query>' 212 $this->server->httpRequest =
$request;
215 $this->server->exec();
217 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
226 $this->assertEquals([
227 '/addressbooks/user1/book1/card1' => [
229 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") .
'"',
230 '{urn:ietf:params:xml:ns:carddav}address-data' =>
'["vcard",[["version",{},"text","4.0"],["prodid",{},"text","-\/\/Sabre\/\/Sabre VObject ' . $vobjVersion .
'\/\/EN"],["uid",{},"text","12345"]]]',
241 '/addressbooks/user1/book1/card1',
246 '<?xml version="1.0"?> 247 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 249 <c:address-data content-type="text/vcard" version="4.0" /> 252 </c:addressbook-query>' 257 $this->server->httpRequest =
$request;
260 $this->server->exec();
262 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
271 $this->assertEquals([
272 '/addressbooks/user1/book1/card1' => [
274 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") .
'"',
275 '{urn:ietf:params:xml:ns:carddav}address-data' =>
"BEGIN:VCARD\r\nVERSION:4.0\r\nPRODID:-//Sabre//Sabre VObject $vobjVersion//EN\r\nUID:12345\r\nEND:VCARD\r\n",
286 '/addressbooks/user1/book1',
291 '<?xml version="1.0"?> 292 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 294 <c:address-data content-type="application/vcard+json" /> 297 </c:addressbook-query>' 302 $this->server->httpRequest =
$request;
305 $this->server->exec();
307 $this->assertEquals(415,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
314 '/addressbooks/user1/book3',
319 '<?xml version="1.0"?> 320 <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> 324 <c:prop name="BDAY"/> 328 </c:addressbook-query>' 333 $this->server->httpRequest =
$request;
336 $this->server->exec();
338 $this->assertEquals(207,
$response->status,
'Incorrect status code. Full response body:' .
$response->body);
345 $this->assertEquals([
346 '/addressbooks/user1/book3/card3' => [
348 '{DAV:}getetag' =>
'"' . md5(
"BEGIN:VCARD\nVERSION:3.0\nUID:12345\nFN:Test-Card\nEMAIL;TYPE=home:bar@example.org\nEND:VCARD") .
'"',
349 '{urn:ietf:params:xml:ns:carddav}address-data' =>
"BEGIN:VCARD\r\nVERSION:3.0\r\nUID:12345\r\nFN:Test-Card\r\nEND:VCARD\r\n",
foreach($paths as $path) $request
const VERSION
Full version number.
if($_SERVER['argc']< 4) $client
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
testAddressBookProperties()