mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 18:38:49 +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
18
dav/SabreDAV/tests/Sabre/CalDAV/Principal/CollectionTest.php
Normal file
18
dav/SabreDAV/tests/Sabre/CalDAV/Principal/CollectionTest.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
require_once 'Sabre/DAVACL/MockPrincipalBackend.php';
|
||||
|
||||
class Sabre_CalDAV_Principal_CollectionTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function testGetChildForPrincipal() {
|
||||
|
||||
$back = new Sabre_DAVACL_MockPrincipalBackend();
|
||||
$col = new Sabre_CalDAV_Principal_Collection($back);
|
||||
$r = $col->getChildForPrincipal(array(
|
||||
'uri' => 'principals/admin',
|
||||
));
|
||||
$this->assertInstanceOf('Sabre_CalDAV_Principal_User', $r);
|
||||
|
||||
}
|
||||
|
||||
}
|
98
dav/SabreDAV/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
Normal file
98
dav/SabreDAV/tests/Sabre/CalDAV/Principal/ProxyReadTest.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
class Sabre_CalDAV_Principal_ProxyReadTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
protected $backend;
|
||||
|
||||
function getInstance() {
|
||||
|
||||
$backend = new Sabre_DAVACL_MockPrincipalBackend();
|
||||
$principal = new Sabre_CalDAV_Principal_ProxyRead($backend, array(
|
||||
'uri' => 'principal/user',
|
||||
));
|
||||
$this->backend = $backend;
|
||||
return $principal;
|
||||
|
||||
}
|
||||
|
||||
function testGetName() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('calendar-proxy-read', $i->getName());
|
||||
|
||||
}
|
||||
function testGetDisplayName() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('calendar-proxy-read', $i->getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
function testGetLastModified() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertNull($i->getLastModified());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
||||
*/
|
||||
function testDelete() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$i->delete();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
||||
*/
|
||||
function testSetName() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$i->setName('foo');
|
||||
|
||||
}
|
||||
|
||||
function testGetAlternateUriSet() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals(array(), $i->getAlternateUriSet());
|
||||
|
||||
}
|
||||
|
||||
function testGetPrincipalUri() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('principal/user/calendar-proxy-read', $i->getPrincipalUrl());
|
||||
|
||||
}
|
||||
|
||||
function testGetGroupMemberSet() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals(array(), $i->getGroupMemberSet());
|
||||
|
||||
}
|
||||
|
||||
function testGetGroupMembership() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals(array(), $i->getGroupMembership());
|
||||
|
||||
}
|
||||
|
||||
function testSetGroupMemberSet() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$i->setGroupMemberSet(array('principals/foo'));
|
||||
|
||||
$expected = array(
|
||||
$i->getPrincipalUrl() => array('principals/foo')
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->backend->groupMembers);
|
||||
|
||||
}
|
||||
}
|
36
dav/SabreDAV/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php
Normal file
36
dav/SabreDAV/tests/Sabre/CalDAV/Principal/ProxyWriteTest.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
class Sabre_CalDAV_Principal_ProxyWriteTest extends Sabre_CalDAV_Principal_ProxyReadTest {
|
||||
|
||||
function getInstance() {
|
||||
|
||||
$backend = new Sabre_DAVACL_MockPrincipalBackend();
|
||||
$principal = new Sabre_CalDAV_Principal_ProxyWrite($backend, array(
|
||||
'uri' => 'principal/user',
|
||||
));
|
||||
$this->backend = $backend;
|
||||
return $principal;
|
||||
|
||||
}
|
||||
|
||||
function testGetName() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('calendar-proxy-write', $i->getName());
|
||||
|
||||
}
|
||||
function testGetDisplayName() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('calendar-proxy-write', $i->getDisplayName());
|
||||
|
||||
}
|
||||
|
||||
function testGetPrincipalUri() {
|
||||
|
||||
$i = $this->getInstance();
|
||||
$this->assertEquals('principal/user/calendar-proxy-write', $i->getPrincipalUrl());
|
||||
|
||||
}
|
||||
|
||||
}
|
123
dav/SabreDAV/tests/Sabre/CalDAV/Principal/UserTest.php
Normal file
123
dav/SabreDAV/tests/Sabre/CalDAV/Principal/UserTest.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
class Sabre_CalDAV_Principal_UserTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function getInstance() {
|
||||
|
||||
$backend = new Sabre_DAVACL_MockPrincipalBackend();
|
||||
$backend->addPrincipal(array(
|
||||
'uri' => 'principals/user/calendar-proxy-read',
|
||||
));
|
||||
$backend->addPrincipal(array(
|
||||
'uri' => 'principals/user/calendar-proxy-write',
|
||||
));
|
||||
$backend->addPrincipal(array(
|
||||
'uri' => 'principals/user/random',
|
||||
));
|
||||
return new Sabre_CalDAV_Principal_User($backend, array(
|
||||
'uri' => 'principals/user',
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
||||
*/
|
||||
function testCreateFile() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$u->createFile('test');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_Forbidden
|
||||
*/
|
||||
function testCreateDirectory() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$u->createDirectory('test');
|
||||
|
||||
}
|
||||
|
||||
function testGetChildProxyRead() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$child = $u->getChild('calendar-proxy-read');
|
||||
$this->assertInstanceOf('Sabre_CalDAV_Principal_ProxyRead', $child);
|
||||
|
||||
}
|
||||
|
||||
function testGetChildProxyWrite() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$child = $u->getChild('calendar-proxy-write');
|
||||
$this->assertInstanceOf('Sabre_CalDAV_Principal_ProxyWrite', $child);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_NotFound
|
||||
*/
|
||||
function testGetChildNotFound() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$child = $u->getChild('foo');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabre_DAV_Exception_NotFound
|
||||
*/
|
||||
function testGetChildNotFound2() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$child = $u->getChild('random');
|
||||
|
||||
}
|
||||
|
||||
function testGetChildren() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$children = $u->getChildren();
|
||||
$this->assertEquals(2, count($children));
|
||||
$this->assertInstanceOf('Sabre_CalDAV_Principal_ProxyRead', $children[0]);
|
||||
$this->assertInstanceOf('Sabre_CalDAV_Principal_ProxyWrite', $children[1]);
|
||||
|
||||
}
|
||||
|
||||
function testChildExist() {
|
||||
|
||||
$u = $this->getInstance();
|
||||
$this->assertTrue($u->childExists('calendar-proxy-read'));
|
||||
$this->assertTrue($u->childExists('calendar-proxy-write'));
|
||||
$this->assertFalse($u->childExists('foo'));
|
||||
|
||||
}
|
||||
|
||||
function testGetACL() {
|
||||
|
||||
$expected = array(
|
||||
array(
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => 'principals/user',
|
||||
'protected' => true,
|
||||
),
|
||||
array(
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => 'principals/user/calendar-proxy-read',
|
||||
'protected' => true,
|
||||
),
|
||||
array(
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => 'principals/user/calendar-proxy-write',
|
||||
'protected' => true,
|
||||
),
|
||||
);
|
||||
|
||||
$u = $this->getInstance();
|
||||
$this->assertEquals($expected, $u->getACL());
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue