Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1842028
HomeCollectionTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
HomeCollectionTest.php
View Options
<?php
namespace
Sabre\DAVACL\FS
;
use
Sabre\DAVACL\PrincipalBackend\Mock
as
PrincipalBackend
;
class
HomeCollectionTest
extends
\PHPUnit_Framework_TestCase
{
/**
* System under test
*
* @var HomeCollection
*/
protected
$sut
;
protected
$path
;
protected
$name
=
'thuis'
;
function
setUp
()
{
$principalBackend
=
new
PrincipalBackend
();
$this
->
path
=
SABRE_TEMPDIR
.
'/home'
;
$this
->
sut
=
new
HomeCollection
(
$principalBackend
,
$this
->
path
);
$this
->
sut
->
collectionName
=
$this
->
name
;
}
function
tearDown
()
{
\Sabre\TestUtil
::
clearTempDir
();
}
function
testGetName
()
{
$this
->
assertEquals
(
$this
->
name
,
$this
->
sut
->
getName
()
);
}
function
testGetChild
()
{
$child
=
$this
->
sut
->
getChild
(
'user1'
);
$this
->
assertInstanceOf
(
'Sabre
\\
DAVACL
\\
FS
\\
Collection'
,
$child
);
$this
->
assertEquals
(
'user1'
,
$child
->
getName
());
$owner
=
'principals/user1'
;
$acl
=
[
[
'privilege'
=>
'{DAV:}read'
,
'principal'
=>
$owner
,
'protected'
=>
true
,
],
[
'privilege'
=>
'{DAV:}write'
,
'principal'
=>
$owner
,
'protected'
=>
true
,
],
];
$this
->
assertEquals
(
$acl
,
$child
->
getACL
());
$this
->
assertEquals
(
$owner
,
$child
->
getOwner
());
}
function
testGetOwner
()
{
$this
->
assertNull
(
$this
->
sut
->
getOwner
()
);
}
function
testGetGroup
()
{
$this
->
assertNull
(
$this
->
sut
->
getGroup
()
);
}
function
testGetACL
()
{
$acl
=
[
[
'principal'
=>
'{DAV:}authenticated'
,
'privilege'
=>
'{DAV:}read'
,
'protected'
=>
true
,
]
];
$this
->
assertEquals
(
$acl
,
$this
->
sut
->
getACL
()
);
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
function
testSetAcl
()
{
$this
->
sut
->
setACL
([]);
}
function
testGetSupportedPrivilegeSet
()
{
$this
->
assertNull
(
$this
->
sut
->
getSupportedPrivilegeSet
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jan 7, 11:05 PM (1 d, 19 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
914851
Default Alt Text
HomeCollectionTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment