moved deprecated communityhome, dav and yourls to the deprecated-addons repository

This commit is contained in:
Tobias Diekershoff 2018-06-02 11:23:11 +02:00
commit 31520f804d
675 changed files with 195144 additions and 0 deletions

View file

@ -0,0 +1,64 @@
<?php
require_once 'Sabre/DAV/AbstractServer.php';
class Sabre_DAV_Browser_GuessContentTypeTest extends Sabre_DAV_AbstractServer {
function setUp() {
parent::setUp();
file_put_contents(SABRE_TEMPDIR . '/somefile.jpg','blabla');
file_put_contents(SABRE_TEMPDIR . '/somefile.hoi','blabla');
}
function tearDown() {
unlink(SABRE_TEMPDIR . '/somefile.jpg');
parent::tearDown();
}
function testGetProperties() {
$properties = array(
'{DAV:}getcontenttype',
);
$result = $this->server->getPropertiesForPath('/somefile.jpg',$properties);
$this->assertArrayHasKey(0,$result);
$this->assertArrayHasKey(404,$result[0]);
$this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][404]);
}
/**
* @depends testGetProperties
*/
function testGetPropertiesPluginEnabled() {
$this->server->addPlugin(new Sabre_DAV_Browser_GuessContentType());
$properties = array(
'{DAV:}getcontenttype',
);
$result = $this->server->getPropertiesForPath('/somefile.jpg',$properties);
$this->assertArrayHasKey(0,$result);
$this->assertArrayHasKey(200,$result[0]);
$this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][200]);
$this->assertEquals('image/jpeg',$result[0][200]['{DAV:}getcontenttype']);
}
/**
* @depends testGetPropertiesPluginEnabled
*/
function testGetPropertiesUnknown() {
$this->server->addPlugin(new Sabre_DAV_Browser_GuessContentType());
$properties = array(
'{DAV:}getcontenttype',
);
$result = $this->server->getPropertiesForPath('/somefile.hoi',$properties);
$this->assertArrayHasKey(0,$result);
$this->assertArrayHasKey(404,$result[0]);
$this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][404]);
}
}

View file

@ -0,0 +1,38 @@
<?php
require_once 'Sabre/DAV/AbstractServer.php';
class Sabre_DAV_Browser_MapGetToPropFindTest extends Sabre_DAV_AbstractServer {
function setUp() {
parent::setUp();
$this->server->addPlugin(new Sabre_DAV_Browser_MapGetToPropFind());
}
function testCollectionGet() {
$serverVars = array(
'REQUEST_URI' => '/',
'REQUEST_METHOD' => 'GET',
);
$request = new Sabre_HTTP_Request($serverVars);
$request->setBody('');
$this->server->httpRequest = ($request);
$this->server->exec();
$this->assertEquals(array(
'Content-Type' => 'application/xml; charset=utf-8',
'DAV' => '1, 3, extended-mkcol',
),
$this->response->headers
);
$this->assertEquals('HTTP/1.1 207 Multi-Status',$this->response->status,'Incorrect status response received. Full response body: ' . $this->response->body);
}
}

View 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'));
}
}