blob: 8e3c09a60dd0f14851f2bbee017f33292e46075d (
plain)
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 Psecio\Gatekeeper;
class PermissionCollectionTest extends \Psecio\Gatekeeper\Base
{
/**
* Test the location of permissions of a group by ID
*/
public function testFindPermissionsByGroupId()
{
$groupId = 1;
$return = array(
array('name' => 'perm1', 'description' => 'Permission #1'),
array('name' => 'perm2', 'description' => 'Permission #2')
);
$ds = $this->buildMock($return, 'fetch');
$permissions = new PermissionCollection($ds);
$permissions->findByGroupId($groupId);
$this->assertCount(2, $permissions);
}
/**
* Test to ensure permissions are returned when searched by child id
*/
public function testFindChidlrenByPermissionId()
{
$permId = 1;
$return = array(
array('name' => 'perm1', 'description' => 'Permission #1'),
array('name' => 'perm2', 'description' => 'Permission #2')
);
$ds = $this->buildMock($return, 'fetch');
$permissions = new PermissionCollection($ds);
$permissions->findChildrenByPermissionId($permId);
$this->assertCount(2, $permissions);
}
}
|