summaryrefslogtreecommitdiffstats
path: root/tests/Psecio/Gatekeeper/GroupCollectionTest.php
blob: 993e3e59892cada6b4ccb40a14956061de3e07cb (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
<?php

namespace Psecio\Gatekeeper;

class GroupCollectionTest extends \Psecio\Gatekeeper\Base
{
    /**
     * 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);
    }
}