summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Cornutt <chris.cornutt@hp.com>2015-01-15 11:02:57 -0600
committerChris Cornutt <chris.cornutt@hp.com>2015-01-15 11:02:57 -0600
commitaa36a1b94e5c4f3f1644285bc24f946a8642b07a (patch)
treec4d17ab73bcbf55066bc18e59f51ef4c1af6010e
parentc7d38a8ec25eb0c6a132ca34a91abac090820c6f (diff)
downloadgatekeeper-aa36a1b94e5c4f3f1644285bc24f946a8642b07a.zip
gatekeeper-aa36a1b94e5c4f3f1644285bc24f946a8642b07a.tar.gz
gatekeeper-aa36a1b94e5c4f3f1644285bc24f946a8642b07a.tar.bz2
adding test to find child groups
-rw-r--r--tests/Psecio/Gatekeeper/GroupCollectionTest.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/Psecio/Gatekeeper/GroupCollectionTest.php b/tests/Psecio/Gatekeeper/GroupCollectionTest.php
index 2e37055..784afe6 100644
--- a/tests/Psecio/Gatekeeper/GroupCollectionTest.php
+++ b/tests/Psecio/Gatekeeper/GroupCollectionTest.php
@@ -21,4 +21,25 @@ class GroupCollectionTest extends \Psecio\Gatekeeper\Base
$groups->findByUserId($userId);
$this->assertCount(2, $groups);
}
+
+ /**
+ * Test the location and conversion of child groups into instances
+ */
+ public function testFindChildrenGroups()
+ {
+ $groupId = 1;
+ $return = array(
+ array('name' => 'group1', 'description' => 'Group #1'),
+ array('name' => 'group2', 'description' => 'Group #2')
+ );
+
+ $ds = $this->buildMock($return, 'fetch');
+ $groups = new GroupCollection($ds);
+
+ $groups->findChildrenByGroupId($groupId);
+ $this->assertCount(2, $groups);
+
+ $groups = $groups->toArray();
+ $this->assertTrue($groups[0] instanceof GroupModel);
+ }
} \ No newline at end of file