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

Public Member Functions

 setUp ()
 
 testInit ()
 
 testPatchNoRange ()
 
 testPatchNotSupported ()
 
 testPatchNoContentType ()
 
 testPatchBadRange ()
 
 testPatchNoLength ()
 
 testPatchSuccess ()
 
 testPatchNoEndRange ()
 
- 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)
 

Protected Attributes

 $node
 
 $plugin
 
- 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 10 of file PluginTest.php.

Member Function Documentation

◆ setUp()

Sabre\DAV\PartialUpdate\PluginTest::setUp ( )

Reimplemented from Sabre\DAVServerTest.

Definition at line 15 of file PluginTest.php.

15 {
16
17 $this->node = new FileMock();
18 $this->tree[] = $this->node;
19
20 parent::setUp();
21
22 $this->plugin = new Plugin();
23 $this->server->addPlugin($this->plugin);
24
25
26
27 }

References Sabre\DAV\PartialUpdate\PluginTest\$node.

◆ testInit()

Sabre\DAV\PartialUpdate\PluginTest::testInit ( )

Definition at line 29 of file PluginTest.php.

29 {
30
31 $this->assertEquals('partialupdate', $this->plugin->getPluginName());
32 $this->assertEquals(['sabredav-partialupdate'], $this->plugin->getFeatures());
33 $this->assertEquals([
34 'PATCH'
35 ], $this->plugin->getHTTPMethods('partial'));
36 $this->assertEquals([
37 ], $this->plugin->getHTTPMethods(''));
38
39 }

◆ testPatchBadRange()

Sabre\DAV\PartialUpdate\PluginTest::testPatchBadRange ( )

Definition at line 80 of file PluginTest.php.

80 {
81
82 $this->node->put('aaaaaaaa');
83 $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-4', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => '3']);
84 $request->setBody(
85 'bbb'
86 );
87 $response = $this->request($request);
88
89 $this->assertEquals(416, $response->status, 'Full response body:' . $response->body);
90
91 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response

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

+ Here is the call graph for this function:

◆ testPatchNoContentType()

Sabre\DAV\PartialUpdate\PluginTest::testPatchNoContentType ( )

Definition at line 67 of file PluginTest.php.

67 {
68
69 $this->node->put('aaaaaaaa');
70 $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-4']);
71 $request->setBody(
72 'bbb'
73 );
74 $response = $this->request($request);
75
76 $this->assertEquals(415, $response->status, 'Full response body:' . $response->body);
77
78 }

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

+ Here is the call graph for this function:

◆ testPatchNoEndRange()

Sabre\DAV\PartialUpdate\PluginTest::testPatchNoEndRange ( )

Definition at line 120 of file PluginTest.php.

120 {
121
122 $this->node->put('aaaaa');
123 $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => '3']);
124 $request->setBody(
125 'bbb'
126 );
127
128 $response = $this->request($request);
129
130 $this->assertEquals(204, $response->getStatus(), 'Full response body:' . $response->getBodyAsString());
131 $this->assertEquals('aaabbb', $this->node->get());
132
133 }

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

+ Here is the call graph for this function:

◆ testPatchNoLength()

Sabre\DAV\PartialUpdate\PluginTest::testPatchNoLength ( )

Definition at line 93 of file PluginTest.php.

93 {
94
95 $this->node->put('aaaaaaaa');
96 $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-5', 'Content-Type' => 'application/x-sabredav-partialupdate']);
97 $request->setBody(
98 'bbb'
99 );
100 $response = $this->request($request);
101
102 $this->assertEquals(411, $response->status, 'Full response body:' . $response->body);
103
104 }

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

+ Here is the call graph for this function:

◆ testPatchNoRange()

Sabre\DAV\PartialUpdate\PluginTest::testPatchNoRange ( )

Definition at line 41 of file PluginTest.php.

41 {
42
43 $this->node->put('aaaaaaaa');
45 'REQUEST_METHOD' => 'PATCH',
46 'REQUEST_URI' => '/partial',
47 ]);
48 $response = $this->request($request);
49
50 $this->assertEquals(400, $response->status, 'Full response body:' . $response->body);
51
52 }
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107

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

+ Here is the call graph for this function:

◆ testPatchNotSupported()

Sabre\DAV\PartialUpdate\PluginTest::testPatchNotSupported ( )

Definition at line 54 of file PluginTest.php.

54 {
55
56 $this->node->put('aaaaaaaa');
57 $request = new HTTP\Request('PATCH', '/', ['X-Update-Range' => '3-4']);
58 $request->setBody(
59 'bbb'
60 );
61 $response = $this->request($request);
62
63 $this->assertEquals(405, $response->status, 'Full response body:' . $response->body);
64
65 }

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

+ Here is the call graph for this function:

◆ testPatchSuccess()

Sabre\DAV\PartialUpdate\PluginTest::testPatchSuccess ( )

Definition at line 106 of file PluginTest.php.

106 {
107
108 $this->node->put('aaaaaaaa');
109 $request = new HTTP\Request('PATCH', '/partial', ['X-Update-Range' => 'bytes=3-5', 'Content-Type' => 'application/x-sabredav-partialupdate', 'Content-Length' => 3]);
110 $request->setBody(
111 'bbb'
112 );
113 $response = $this->request($request);
114
115 $this->assertEquals(204, $response->status, 'Full response body:' . $response->body);
116 $this->assertEquals('aaabbbaa', $this->node->get());
117
118 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $node

Sabre\DAV\PartialUpdate\PluginTest::$node
protected

Definition at line 12 of file PluginTest.php.

Referenced by Sabre\DAV\PartialUpdate\PluginTest\setUp().

◆ $plugin

Sabre\DAV\PartialUpdate\PluginTest::$plugin
protected

Definition at line 13 of file PluginTest.php.


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