ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CardDAV\MultiGetTest Class Reference
+ Inheritance diagram for Sabre\CardDAV\MultiGetTest:
+ Collaboration diagram for Sabre\CardDAV\MultiGetTest:

Public Member Functions

 testMultiGet ()
 
 testMultiGetVCard4 ()
 
- Public Member Functions inherited from Sabre\CardDAV\AbstractPluginTest
 setUp ()
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\CardDAV\AbstractPluginTest
 $plugin
 
 $server
 
 $backend
 

Detailed Description

Definition at line 10 of file MultiGetTest.php.

Member Function Documentation

◆ testMultiGet()

Sabre\CardDAV\MultiGetTest::testMultiGet ( )

Definition at line 12 of file MultiGetTest.php.

References $client, $request, $response, $result, and Sabre\HTTP\Sapi\createFromServerArray().

12  {
13 
15  'REQUEST_METHOD' => 'REPORT',
16  'REQUEST_URI' => '/addressbooks/user1/book1',
17  ]);
18 
19  $request->setBody(
20 '<?xml version="1.0"?>
21 <c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
22  <d:prop>
23  <d:getetag />
24  <c:address-data />
25  </d:prop>
26  <d:href>/addressbooks/user1/book1/card1</d:href>
27 </c:addressbook-multiget>'
28  );
29 
30  $response = new HTTP\ResponseMock();
31 
32  $this->server->httpRequest = $request;
33  $this->server->httpResponse = $response;
34 
35  $this->server->exec();
36 
37  $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
38 
39  // using the client for parsing
40  $client = new DAV\Client(['baseUri' => '/']);
41 
42  $result = $client->parseMultiStatus($response->body);
43 
44  $this->assertEquals([
45  '/addressbooks/user1/book1/card1' => [
46  200 => [
47  '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
48  '{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD",
49  ]
50  ]
51  ], $result);
52 
53  }
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response
+ Here is the call graph for this function:

◆ testMultiGetVCard4()

Sabre\CardDAV\MultiGetTest::testMultiGetVCard4 ( )

Definition at line 55 of file MultiGetTest.php.

References $client, $request, $response, $result, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\VObject\Version\VERSION.

55  {
56 
58  'REQUEST_METHOD' => 'REPORT',
59  'REQUEST_URI' => '/addressbooks/user1/book1',
60  ]);
61 
62  $request->setBody(
63 '<?xml version="1.0"?>
64 <c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
65  <d:prop>
66  <d:getetag />
67  <c:address-data content-type="text/vcard" version="4.0" />
68  </d:prop>
69  <d:href>/addressbooks/user1/book1/card1</d:href>
70 </c:addressbook-multiget>'
71  );
72 
73  $response = new HTTP\ResponseMock();
74 
75  $this->server->httpRequest = $request;
76  $this->server->httpResponse = $response;
77 
78  $this->server->exec();
79 
80  $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body);
81 
82  // using the client for parsing
83  $client = new DAV\Client(['baseUri' => '/']);
84 
85  $result = $client->parseMultiStatus($response->body);
86 
87  $prodId = "PRODID:-//Sabre//Sabre VObject " . \Sabre\VObject\Version::VERSION . "//EN";
88 
89  $this->assertEquals([
90  '/addressbooks/user1/book1/card1' => [
91  200 => [
92  '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"',
93  '{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:4.0\r\n$prodId\r\nUID:12345\r\nEND:VCARD\r\n",
94  ]
95  ]
96  ], $result);
97 
98  }
$result
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: