ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\HttpGetTest Class Reference

Tests related to the GET request. More...

+ Inheritance diagram for Sabre\DAV\HttpGetTest:
+ Collaboration diagram for Sabre\DAV\HttpGetTest:

Public Member Functions

 setUpTree ()
 Sets up the DAV tree. More...
 
 testGet ()
 
 testGetHttp10 ()
 
 testGet404 ()
 
 testGet404_aswell ()
 
 testGetDoubleSlash ()
 We automatically normalize double slashes. More...
 
 testGetCollection ()
 
 testGetStreaming ()
 
- 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

Tests related to the GET request.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 15 of file HttpGetTest.php.

Member Function Documentation

◆ setUpTree()

Sabre\DAV\HttpGetTest::setUpTree ( )

Sets up the DAV tree.

Returns
void

Definition at line 22 of file HttpGetTest.php.

22  {
23 
24  $this->tree = new Mock\Collection('root', [
25  'file1' => 'foo',
26  new Mock\Collection('dir', []),
27  new Mock\StreamingFile('streaming', 'stream')
28  ]);
29 
30  }

◆ testGet()

Sabre\DAV\HttpGetTest::testGet ( )

Definition at line 32 of file HttpGetTest.php.

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

32  {
33 
34  $request = new HTTP\Request('GET', '/file1');
35  $response = $this->request($request);
36 
37  $this->assertEquals(200, $response->getStatus());
38 
39  // Removing Last-Modified because it keeps changing.
40  $response->removeHeader('Last-Modified');
41 
42  $this->assertEquals(
43  [
44  'X-Sabre-Version' => [Version::VERSION],
45  'Content-Type' => ['application/octet-stream'],
46  'Content-Length' => [3],
47  'ETag' => ['"' . md5('foo') . '"'],
48  ],
49  $response->getHeaders()
50  );
51 
52  $this->assertEquals('foo', $response->getBodyAsString());
53 
54  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testGet404()

Sabre\DAV\HttpGetTest::testGet404 ( )

Definition at line 83 of file HttpGetTest.php.

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

83  {
84 
85  $request = new HTTP\Request('GET', '/notfound');
86  $response = $this->request($request);
87 
88  $this->assertEquals(404, $response->getStatus());
89 
90  }
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:

◆ testGet404_aswell()

Sabre\DAV\HttpGetTest::testGet404_aswell ( )

Definition at line 92 of file HttpGetTest.php.

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

92  {
93 
94  $request = new HTTP\Request('GET', '/file1/subfile');
95  $response = $this->request($request);
96 
97  $this->assertEquals(404, $response->getStatus());
98 
99  }
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:

◆ testGetCollection()

Sabre\DAV\HttpGetTest::testGetCollection ( )

Definition at line 128 of file HttpGetTest.php.

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

128  {
129 
130  $request = new HTTP\Request('GET', '/dir');
131  $response = $this->request($request);
132 
133  $this->assertEquals(501, $response->getStatus());
134 
135  }
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:

◆ testGetDoubleSlash()

Sabre\DAV\HttpGetTest::testGetDoubleSlash ( )

We automatically normalize double slashes.

Definition at line 104 of file HttpGetTest.php.

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

104  {
105 
106  $request = new HTTP\Request('GET', '//file1');
107  $response = $this->request($request);
108 
109  $this->assertEquals(200, $response->getStatus());
110 
111  // Removing Last-Modified because it keeps changing.
112  $response->removeHeader('Last-Modified');
113 
114  $this->assertEquals(
115  [
116  'X-Sabre-Version' => [Version::VERSION],
117  'Content-Type' => ['application/octet-stream'],
118  'Content-Length' => [3],
119  'ETag' => ['"' . md5('foo') . '"'],
120  ],
121  $response->getHeaders()
122  );
123 
124  $this->assertEquals('foo', $response->getBodyAsString());
125 
126  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testGetHttp10()

Sabre\DAV\HttpGetTest::testGetHttp10 ( )

Definition at line 56 of file HttpGetTest.php.

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

56  {
57 
58  $request = new HTTP\Request('GET', '/file1');
59  $request->setHttpVersion('1.0');
60  $response = $this->request($request);
61 
62  $this->assertEquals(200, $response->getStatus());
63 
64  // Removing Last-Modified because it keeps changing.
65  $response->removeHeader('Last-Modified');
66 
67  $this->assertEquals(
68  [
69  'X-Sabre-Version' => [Version::VERSION],
70  'Content-Type' => ['application/octet-stream'],
71  'Content-Length' => [3],
72  'ETag' => ['"' . md5('foo') . '"'],
73  ],
74  $response->getHeaders()
75  );
76 
77  $this->assertEquals('1.0', $response->getHttpVersion());
78 
79  $this->assertEquals('foo', $response->getBodyAsString());
80 
81  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testGetStreaming()

Sabre\DAV\HttpGetTest::testGetStreaming ( )

Definition at line 137 of file HttpGetTest.php.

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

137  {
138 
139  $request = new HTTP\Request('GET', '/streaming');
140  $response = $this->request($request);
141 
142  $this->assertEquals(200, $response->getStatus());
143 
144  // Removing Last-Modified because it keeps changing.
145  $response->removeHeader('Last-Modified');
146 
147  $this->assertEquals(
148  [
149  'X-Sabre-Version' => [Version::VERSION],
150  'Content-Type' => ['application/octet-stream'],
151  ],
152  $response->getHeaders()
153  );
154 
155  $this->assertEquals('stream', $response->getBodyAsString());
156 
157  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
const VERSION
Full version number.
Definition: Version.php:17
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: