"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/Sabre/DAV/ServerMKCOLTest.php" between
dav-4.0.2.tar.gz and dav-4.0.3.tar.gz

About: sabre/dav is a WebDAV framework for PHP allowing to create WebDAV, CalDAV and CardDAV servers.

ServerMKCOLTest.php  (dav-4.0.2):ServerMKCOLTest.php  (dav-4.0.3)
skipping to change at line 29 skipping to change at line 29
$request->setBody(''); $request->setBody('');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(201, $this->response->status); $this->assertEquals(201, $this->response->status);
$this->assertEquals('', $this->response->body); $this->assertEquals('', $this->response->getBodyAsString());
$this->assertTrue(is_dir($this->tempDir.'/testcol')); $this->assertTrue(is_dir($this->tempDir.'/testcol'));
} }
/** /**
* @depends testMkcol * @depends testMkcol
*/ */
public function testMKCOLUnknownBody() public function testMKCOLUnknownBody()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/testcol', 'REQUEST_URI' => '/testcol',
skipping to change at line 132 skipping to change at line 132
</set> </set>
</mkcol>'); </mkcol>');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(400, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(400, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMkcol * @depends testMkcol
*/ */
public function testMKCOLIncorrectResourceType() public function testMKCOLIncorrectResourceType()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/testcol', 'REQUEST_URI' => '/testcol',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 163 skipping to change at line 163
</set> </set>
</mkcol>'); </mkcol>');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(403, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(403, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLIncorrectResourceType * @depends testMKCOLIncorrectResourceType
*/ */
public function testMKCOLSuccess() public function testMKCOLSuccess()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/testcol', 'REQUEST_URI' => '/testcol',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 194 skipping to change at line 194
</set> </set>
</mkcol>'); </mkcol>');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(201, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(201, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLIncorrectResourceType * @depends testMKCOLIncorrectResourceType
*/ */
public function testMKCOLWhiteSpaceResourceType() public function testMKCOLWhiteSpaceResourceType()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/testcol', 'REQUEST_URI' => '/testcol',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 227 skipping to change at line 227
</set> </set>
</mkcol>'); </mkcol>');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Length' => ['0'], 'Content-Length' => ['0'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(201, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(201, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLIncorrectResourceType * @depends testMKCOLIncorrectResourceType
*/ */
public function testMKCOLNoParent() public function testMKCOLNoParent()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/testnoparent/409me', 'REQUEST_URI' => '/testnoparent/409me',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 251 skipping to change at line 251
$request->setBody(''); $request->setBody('');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(409, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(409, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLIncorrectResourceType * @depends testMKCOLIncorrectResourceType
*/ */
public function testMKCOLParentIsNoCollection() public function testMKCOLParentIsNoCollection()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/test.txt/409me', 'REQUEST_URI' => '/test.txt/409me',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 275 skipping to change at line 275
$request->setBody(''); $request->setBody('');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(409, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(409, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLIncorrectResourceType * @depends testMKCOLIncorrectResourceType
*/ */
public function testMKCOLAlreadyExists() public function testMKCOLAlreadyExists()
{ {
$serverVars = [ $serverVars = [
'REQUEST_URI' => '/test.txt', 'REQUEST_URI' => '/test.txt',
'REQUEST_METHOD' => 'MKCOL', 'REQUEST_METHOD' => 'MKCOL',
skipping to change at line 300 skipping to change at line 300
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, C OPY, MOVE, REPORT'], 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, C OPY, MOVE, REPORT'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$this->assertEquals(405, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->body); $this->assertEquals(405, $this->response->status, 'Wrong statuscode rece ived. Full response body: '.$this->response->getBodyAsString());
} }
/** /**
* @depends testMKCOLSuccess * @depends testMKCOLSuccess
* @depends testMKCOLAlreadyExists * @depends testMKCOLAlreadyExists
*/ */
public function testMKCOLAndProps() public function testMKCOLAndProps()
{ {
$request = new HTTP\Request( $request = new HTTP\Request(
'MKCOL', 'MKCOL',
skipping to change at line 326 skipping to change at line 326
<set> <set>
<prop> <prop>
<resourcetype><collection /></resourcetype> <resourcetype><collection /></resourcetype>
<displayname>my new collection</displayname> <displayname>my new collection</displayname>
</prop> </prop>
</set> </set>
</mkcol>'); </mkcol>');
$this->server->httpRequest = ($request); $this->server->httpRequest = ($request);
$this->server->exec(); $this->server->exec();
$this->assertEquals(207, $this->response->status, 'Wrong statuscode rece $bodyAsString = $this->response->getBodyAsString();
ived. Full response body: '.$this->response->body); $this->assertEquals(207, $this->response->status, 'Wrong statuscode rece
ived. Full response body: '.$bodyAsString);
$this->assertEquals([ $this->assertEquals([
'X-Sabre-Version' => [Version::VERSION], 'X-Sabre-Version' => [Version::VERSION],
'Content-Type' => ['application/xml; charset=utf-8'], 'Content-Type' => ['application/xml; charset=utf-8'],
], $this->response->getHeaders()); ], $this->response->getHeaders());
$responseBody = $this->response->getBodyAsString();
$expected = <<<XML $expected = <<<XML
<?xml version="1.0"?> <?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<d:response> <d:response>
<d:href>/testcol</d:href> <d:href>/testcol</d:href>
<d:propstat> <d:propstat>
<d:prop> <d:prop>
<d:displayname /> <d:displayname />
</d:prop> </d:prop>
<d:status>HTTP/1.1 403 Forbidden</d:status> <d:status>HTTP/1.1 403 Forbidden</d:status>
</d:propstat> </d:propstat>
</d:response> </d:response>
</d:multistatus> </d:multistatus>
XML; XML;
$this->assertXmlStringEqualsXmlString( $this->assertXmlStringEqualsXmlString(
$expected, $expected,
$responseBody $bodyAsString
); );
} }
} }
 End of changes. 11 change blocks. 
13 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)