2013-10-21 22:46:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Sabre\CalDAV\Notifications;
|
|
|
|
|
|
|
|
use Sabre\CalDAV;
|
|
|
|
|
|
|
|
class CollectionTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
protected $caldavBackend;
|
|
|
|
protected $principalUri;
|
|
|
|
protected $notification;
|
|
|
|
|
|
|
|
function getInstance() {
|
|
|
|
|
|
|
|
$this->principalUri = 'principals/user1';
|
|
|
|
|
2016-05-28 15:46:24 +00:00
|
|
|
$this->notification = new CalDAV\Xml\Notification\SystemStatus(1, '"1"');
|
2013-10-21 22:46:31 +00:00
|
|
|
|
2016-05-28 15:46:24 +00:00
|
|
|
$this->caldavBackend = new CalDAV\Backend\MockSharing([], [], [
|
|
|
|
'principals/user1' => [
|
2013-10-21 22:46:31 +00:00
|
|
|
$this->notification
|
2016-05-28 15:46:24 +00:00
|
|
|
]
|
|
|
|
]);
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
return new Collection($this->caldavBackend, $this->principalUri);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testGetChildren() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
|
|
|
$this->assertEquals('notifications', $col->getName());
|
|
|
|
|
2016-05-28 15:46:24 +00:00
|
|
|
$this->assertEquals([
|
2013-10-21 22:46:31 +00:00
|
|
|
new Node($this->caldavBackend, $this->principalUri, $this->notification)
|
2016-05-28 15:46:24 +00:00
|
|
|
], $col->getChildren());
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testGetOwner() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
|
|
|
$this->assertEquals('principals/user1', $col->getOwner());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testGetGroup() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
|
|
|
$this->assertNull($col->getGroup());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testGetACL() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
2016-05-28 15:46:24 +00:00
|
|
|
$expected = [
|
|
|
|
[
|
|
|
|
'privilege' => '{DAV:}all',
|
|
|
|
'principal' => '{DAV:}owner',
|
2013-10-21 22:46:31 +00:00
|
|
|
'protected' => true,
|
2016-05-28 15:46:24 +00:00
|
|
|
],
|
|
|
|
];
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
$this->assertEquals($expected, $col->getACL());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-05-28 15:46:24 +00:00
|
|
|
* @expectedException \Sabre\DAV\Exception\Forbidden
|
2013-10-21 22:46:31 +00:00
|
|
|
*/
|
|
|
|
function testSetACL() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
2016-05-28 15:46:24 +00:00
|
|
|
$col->setACL([]);
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testGetSupportedPrivilegeSet() {
|
|
|
|
|
|
|
|
$col = $this->getInstance();
|
|
|
|
$this->assertNull($col->getSupportedPrivilegeSet());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|