diff options
Diffstat (limited to 'tests/Psecio/Gatekeeper/GroupCollectionTest.php')
-rw-r--r-- | tests/Psecio/Gatekeeper/GroupCollectionTest.php | 21 |
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 |