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

This test is an end-to-end sabredav test that goes through all the cases in the specification. More...

+ Inheritance diagram for Sabre\DAV\PartialUpdate\SpecificationTest:
+ Collaboration diagram for Sabre\DAV\PartialUpdate\SpecificationTest:

Public Member Functions

 setUp ()
 
 tearDown ()
 
 testUpdateRange ($headerValue, $httpStatus, $endResult, $contentLength=4)
 
 data ()
 

Protected Attributes

 $server
 

Detailed Description

This test is an end-to-end sabredav test that goes through all the cases in the specification.

See: http://sabre.io/dav/http-patch/

Definition at line 15 of file SpecificationTest.php.

Member Function Documentation

◆ data()

Sabre\DAV\PartialUpdate\SpecificationTest::data ( )

Definition at line 74 of file SpecificationTest.php.

74  {
75 
76  return [
77  // Problems
78  ['foo', 400, null],
79  ['bytes=0-3', 411, null, 0],
80  ['bytes=4-1', 416, null],
81 
82  ['bytes=0-3', 204, '----567890'],
83  ['bytes=1-4', 204, '1----67890'],
84  ['bytes=0-', 204, '----567890'],
85  ['bytes=-4', 204, '123456----'],
86  ['bytes=-2', 204, '12345678----'],
87  ['bytes=2-', 204, '12----7890'],
88  ['append', 204, '1234567890----'],
89 
90  ];
91 
92  }

◆ setUp()

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

Definition at line 19 of file SpecificationTest.php.

References Sabre\DAV\PartialUpdate\SpecificationTest\$server, and $tree.

19  {
20 
21  $tree = [
22  new File(SABRE_TEMPDIR . '/foobar.txt')
23  ];
24  $server = new Server($tree);
25  $server->debugExceptions = true;
26  $server->addPlugin(new Plugin());
27 
28  $tree[0]->put('1234567890');
29 
30  $this->server = $server;
31 
32  }

◆ tearDown()

Sabre\DAV\PartialUpdate\SpecificationTest::tearDown ( )

Definition at line 34 of file SpecificationTest.php.

References Sabre\TestUtil\clearTempDir().

34  {
35 
37 
38  }
static clearTempDir()
This function deletes all the contents of the temporary directory.
Definition: TestUtil.php:12
+ Here is the call graph for this function:

◆ testUpdateRange()

Sabre\DAV\PartialUpdate\SpecificationTest::testUpdateRange (   $headerValue,
  $httpStatus,
  $endResult,
  $contentLength = 4 
)
Parameters
string$headerValue
string$httpStatus
string$endResult
int$contentLengthdata

Definition at line 48 of file SpecificationTest.php.

References $contentLength, and $request.

48  {
49 
50  $headers = [
51  'Content-Type' => 'application/x-sabredav-partialupdate',
52  'X-Update-Range' => $headerValue,
53  ];
54 
55  if ($contentLength) {
56  $headers['Content-Length'] = (string)$contentLength;
57  }
58 
59  $request = new HTTP\Request('PATCH', '/foobar.txt', $headers, '----');
60 
61  $request->setBody('----');
62  $this->server->httpRequest = $request;
63  $this->server->httpResponse = new HTTP\ResponseMock();
64  $this->server->sapi = new HTTP\SapiMock();
65  $this->server->exec();
66 
67  $this->assertEquals($httpStatus, $this->server->httpResponse->status, 'Incorrect http status received: ' . $this->server->httpResponse->body);
68  if (!is_null($endResult)) {
69  $this->assertEquals($endResult, file_get_contents(SABRE_TEMPDIR . '/foobar.txt'));
70  }
71 
72  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
if(preg_match('#\.( $contentLength[^/\.]+)$#D', $path, $type)) if($contentType===null)
Definition: module.php:165

Field Documentation

◆ $server

Sabre\DAV\PartialUpdate\SpecificationTest::$server
protected

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