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

Public Member Functions

 testParseSimple ()
 
 testParseValue ()
 
 testParseMultiple ()
 
 testParseWeirdValue ()
 
 testBrief ()
 
 testpropfindMinimal ()
 propfindMinimal More...
 
 testproppatchMinimal ()
 
 testproppatchMinimalError ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Additional Inherited Members

- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Definition at line 7 of file HTTPPreferParsingTest.php.

Member Function Documentation

◆ testBrief()

Sabre\DAV\HTTPPreferParsingTest::testBrief ( )

Definition at line 82 of file HTTPPreferParsingTest.php.

References Sabre\DAVServerTest\$server, and Sabre\HTTP\Sapi\createFromServerArray().

82  {
83 
84  $httpRequest = HTTP\Sapi::createFromServerArray([
85  'HTTP_BRIEF' => 't',
86  ]);
87 
88  $server = new Server();
89  $server->httpRequest = $httpRequest;
90 
91  $this->assertEquals([
92  'respond-async' => false,
93  'return' => 'minimal',
94  'handling' => null,
95  'wait' => null,
96  ], $server->getHTTPPrefer());
97 
98  }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ Here is the call graph for this function:

◆ testParseMultiple()

Sabre\DAV\HTTPPreferParsingTest::testParseMultiple ( )

Definition at line 45 of file HTTPPreferParsingTest.php.

References Sabre\DAVServerTest\$server, and Sabre\HTTP\Sapi\createFromServerArray().

45  {
46 
47  $httpRequest = HTTP\Sapi::createFromServerArray([
48  'HTTP_PREFER' => 'return-minimal, strict,lenient',
49  ]);
50 
51  $server = new Server();
52  $server->httpRequest = $httpRequest;
53 
54  $this->assertEquals([
55  'respond-async' => false,
56  'return' => 'minimal',
57  'handling' => 'lenient',
58  'wait' => null,
59  ], $server->getHTTPPrefer());
60 
61  }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ Here is the call graph for this function:

◆ testParseSimple()

Sabre\DAV\HTTPPreferParsingTest::testParseSimple ( )

Definition at line 9 of file HTTPPreferParsingTest.php.

References Sabre\DAVServerTest\$server, and Sabre\HTTP\Sapi\createFromServerArray().

9  {
10 
11  $httpRequest = HTTP\Sapi::createFromServerArray([
12  'HTTP_PREFER' => 'return-asynch',
13  ]);
14 
15  $server = new Server();
16  $server->httpRequest = $httpRequest;
17 
18  $this->assertEquals([
19  'respond-async' => true,
20  'return' => null,
21  'handling' => null,
22  'wait' => null,
23  ], $server->getHTTPPrefer());
24 
25  }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ Here is the call graph for this function:

◆ testParseValue()

Sabre\DAV\HTTPPreferParsingTest::testParseValue ( )

Definition at line 27 of file HTTPPreferParsingTest.php.

References Sabre\DAVServerTest\$server, and Sabre\HTTP\Sapi\createFromServerArray().

27  {
28 
29  $httpRequest = HTTP\Sapi::createFromServerArray([
30  'HTTP_PREFER' => 'wait=10',
31  ]);
32 
33  $server = new Server();
34  $server->httpRequest = $httpRequest;
35 
36  $this->assertEquals([
37  'respond-async' => false,
38  'return' => null,
39  'handling' => null,
40  'wait' => '10',
41  ], $server->getHTTPPrefer());
42 
43  }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ Here is the call graph for this function:

◆ testParseWeirdValue()

Sabre\DAV\HTTPPreferParsingTest::testParseWeirdValue ( )

Definition at line 63 of file HTTPPreferParsingTest.php.

References Sabre\DAVServerTest\$server, and Sabre\HTTP\Sapi\createFromServerArray().

63  {
64 
65  $httpRequest = HTTP\Sapi::createFromServerArray([
66  'HTTP_PREFER' => 'BOOOH',
67  ]);
68 
69  $server = new Server();
70  $server->httpRequest = $httpRequest;
71 
72  $this->assertEquals([
73  'respond-async' => false,
74  'return' => null,
75  'handling' => null,
76  'wait' => null,
77  'boooh' => true,
78  ], $server->getHTTPPrefer());
79 
80  }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
+ Here is the call graph for this function:

◆ testpropfindMinimal()

Sabre\DAV\HTTPPreferParsingTest::testpropfindMinimal ( )

propfindMinimal

Returns
void

Definition at line 105 of file HTTPPreferParsingTest.php.

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

105  {
106 
108  'REQUEST_METHOD' => 'PROPFIND',
109  'REQUEST_URI' => '/',
110  'HTTP_PREFER' => 'return-minimal',
111  ]);
112  $request->setBody(<<<BLA
113 <?xml version="1.0"?>
114 <d:propfind xmlns:d="DAV:">
115  <d:prop>
116  <d:something />
117  <d:resourcetype />
118  </d:prop>
119 </d:propfind>
120 BLA
121  );
122 
123  $response = $this->request($request);
124 
125  $body = $response->getBodyAsString();
126 
127  $this->assertEquals(207, $response->getStatus(), $body);
128 
129  $this->assertTrue(strpos($body, 'resourcetype') !== false, $body);
130  $this->assertTrue(strpos($body, 'something') === false, $body);
131 
132  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
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:

◆ testproppatchMinimal()

Sabre\DAV\HTTPPreferParsingTest::testproppatchMinimal ( )

Definition at line 134 of file HTTPPreferParsingTest.php.

References $path, $request, $response, Sabre\DAV\PropPatch\handle(), and Sabre\DAVServerTest\request().

134  {
135 
136  $request = new HTTP\Request('PROPPATCH', '/', ['Prefer' => 'return-minimal']);
137  $request->setBody(<<<BLA
138 <?xml version="1.0"?>
139 <d:propertyupdate xmlns:d="DAV:">
140  <d:set>
141  <d:prop>
142  <d:something>nope!</d:something>
143  </d:prop>
144  </d:set>
145 </d:propertyupdate>
146 BLA
147  );
148 
149  $this->server->on('propPatch', function($path, PropPatch $propPatch) {
150 
151  $propPatch->handle('{DAV:}something', function($props) {
152  return true;
153  });
154 
155  });
156 
157  $response = $this->request($request);
158 
159  $this->assertEquals(0, strlen($response->body), 'Expected empty body: ' . $response->body);
160  $this->assertEquals(204, $response->status);
161 
162  }
$path
Definition: aliased.php:25
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testproppatchMinimalError()

Sabre\DAV\HTTPPreferParsingTest::testproppatchMinimalError ( )

Definition at line 164 of file HTTPPreferParsingTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

164  {
165 
166  $request = new HTTP\Request('PROPPATCH', '/', ['Prefer' => 'return-minimal']);
167  $request->setBody(<<<BLA
168 <?xml version="1.0"?>
169 <d:propertyupdate xmlns:d="DAV:">
170  <d:set>
171  <d:prop>
172  <d:something>nope!</d:something>
173  </d:prop>
174  </d:set>
175 </d:propertyupdate>
176 BLA
177  );
178 
179  $response = $this->request($request);
180 
181  $body = $response->getBodyAsString();
182 
183  $this->assertEquals(207, $response->status);
184  $this->assertTrue(strpos($body, 'something') !== false);
185  $this->assertTrue(strpos($body, '403 Forbidden') !== false, $body);
186 
187  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

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