mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-26 06:21:46 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
108
dav/SabreDAV/tests/Sabre/DAV/Browser/PluginTest.php
Normal file
108
dav/SabreDAV/tests/Sabre/DAV/Browser/PluginTest.php
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
require_once 'Sabre/DAV/AbstractServer.php';
|
||||
|
||||
class Sabre_DAV_Browser_PluginTest extends Sabre_DAV_AbstractServer{
|
||||
|
||||
function setUp() {
|
||||
|
||||
parent::setUp();
|
||||
$this->server->addPlugin(new Sabre_DAV_Browser_Plugin());
|
||||
|
||||
}
|
||||
|
||||
function testCollectionGet() {
|
||||
|
||||
$serverVars = array(
|
||||
'REQUEST_URI' => '/dir',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
);
|
||||
|
||||
$request = new Sabre_HTTP_Request($serverVars);
|
||||
$this->server->httpRequest = ($request);
|
||||
$this->server->exec();
|
||||
|
||||
$this->assertEquals('HTTP/1.1 200 OK',$this->response->status);
|
||||
$this->assertEquals(array(
|
||||
'Content-Type' => 'text/html; charset=utf-8',
|
||||
),
|
||||
$this->response->headers
|
||||
);
|
||||
|
||||
$this->assertTrue(strpos($this->response->body, 'Index for dir/') !== false);
|
||||
|
||||
}
|
||||
|
||||
function testNotFound() {
|
||||
|
||||
$serverVars = array(
|
||||
'REQUEST_URI' => '/random',
|
||||
'REQUEST_METHOD' => 'GET',
|
||||
);
|
||||
|
||||
$request = new Sabre_HTTP_Request($serverVars);
|
||||
$this->server->httpRequest = ($request);
|
||||
$this->server->exec();
|
||||
|
||||
$this->assertEquals('HTTP/1.1 404 Not Found',$this->response->status);
|
||||
|
||||
}
|
||||
|
||||
function testPostOtherContentType() {
|
||||
|
||||
$serverVars = array(
|
||||
'REQUEST_URI' => '/',
|
||||
'REQUEST_METHOD' => 'POST',
|
||||
'CONTENT_TYPE' => 'text/xml',
|
||||
);
|
||||
$request = new Sabre_HTTP_Request($serverVars);
|
||||
$this->server->httpRequest = $request;
|
||||
$this->server->exec();
|
||||
|
||||
$this->assertEquals('HTTP/1.1 501 Not Implemented', $this->response->status);
|
||||
|
||||
}
|
||||
|
||||
function testPostNoSabreAction() {
|
||||
|
||||
$serverVars = array(
|
||||
'REQUEST_URI' => '/',
|
||||
'REQUEST_METHOD' => 'POST',
|
||||
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
|
||||
);
|
||||
$postVars = array();
|
||||
|
||||
$request = new Sabre_HTTP_Request($serverVars,$postVars);
|
||||
$this->server->httpRequest = $request;
|
||||
$this->server->exec();
|
||||
|
||||
$this->assertEquals('HTTP/1.1 501 Not Implemented', $this->response->status);
|
||||
|
||||
}
|
||||
|
||||
function testPostMkCol() {
|
||||
|
||||
$serverVars = array(
|
||||
'REQUEST_URI' => '/',
|
||||
'REQUEST_METHOD' => 'POST',
|
||||
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
|
||||
);
|
||||
$postVars = array(
|
||||
'sabreAction' => 'mkcol',
|
||||
'name' => 'new_collection',
|
||||
);
|
||||
|
||||
$request = new Sabre_HTTP_Request($serverVars,$postVars);
|
||||
$this->server->httpRequest = $request;
|
||||
$this->server->exec();
|
||||
|
||||
$this->assertEquals('HTTP/1.1 302 Found', $this->response->status);
|
||||
$this->assertEquals(array(
|
||||
'Location' => '/',
|
||||
), $this->response->headers);
|
||||
|
||||
$this->assertTrue(is_dir(SABRE_TEMPDIR . '/new_collection'));
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue