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

namespace Psecio\Gatekeeper;

class UserCollectionTest extends \Psecio\Gatekeeper\Base
{
    /**
     * Test the location of users of a group by ID
     */
    public function testFindUsersByGroupId()
    {
        $groupId = 1;
        $return = array(
            array('username' => 'testuser1', 'email' => 'testuser1@gmail.com'),
            array('username' => 'testuser2', 'email' => 'testuser2@gmail.com'),
            array('username' => 'testuser3', 'email' => 'testuser3@gmail.com')
        );

        $ds = $this->buildMock($return, 'fetch');
        $users = new UserCollection($ds);

        $users->findByGroupId($groupId);
        $this->assertCount(3, $users);
        $this->assertEquals($users->toArray()[1]->username, 'testuser2');
    }
}