-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathPrivilegeTest.php
42 lines (34 loc) · 1.22 KB
/
PrivilegeTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace PHPCR\Tests\AccessControlManagement;
use PHPCR\Security\AccessControlManagerInterface;
use PHPCR\Security\PrivilegeInterface;
require_once(__DIR__ . '/../../inc/BaseCase.php');
class PrivilegeTest extends \PHPCR\Test\BaseCase
{
/**
* @var AccessControlManagerInterface
*/
private $manager;
public function setup()
{
parent::setUp();
$this->manager = $this->session->getAccessControlManager();
}
public function testDeclaredAggregatePrivileges()
{
$privileges = $this->manager->getSupportedPrivileges();
$foundAll = false;
foreach ($privileges as $privilege) {
$this->assertInstanceof('\PHPCR\Security\PrivilegeInterface', $privilege);
if (PrivilegeInterface::JCR_ALL === $privilege->getName()) {
$declared = $privilege->getDeclaredAggregatePrivileges();
$this->assertInternalType('array', $declared);
$this->assertContainsOnlyInstancesOf('\PHPCR\Security\PrivilegeInterface', $declared);
$foundAll = true;
}
}
if (!$foundAll) {
$this->fail('Privilege ' . PrivilegeInterface::JCR_ALL . ' not found');
}
}
}