summaryrefslogtreecommitdiff
path: root/tests/integration/GroupProcedureTest.php
blob: 610c121da03284a304eb3a206cd8993a8e7d66cb (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
43
44
45
46
47
48
49
50
<?php

require_once __DIR__.'/BaseProcedureTest.php';

class GroupProcedureTest extends BaseProcedureTest
{
    public function testAll()
    {
        $this->assertCreateGroups();
        $this->assertGetAllGroups();
        $this->assertGetGroup();
        $this->assertUpdateGroup();
        $this->assertRemove();
    }

    public function assertGetAllGroups()
    {
        $groups = $this->app->getAllGroups();
        $this->assertNotEmpty($groups);
        $this->assertArrayHasKey('name', $groups[0]);
        $this->assertArrayHasKey('external_id', $groups[0]);
    }

    public function assertGetGroup()
    {
        $group = $this->app->getGroup($this->groupId1);
        $this->assertNotEmpty($group);
        $this->assertEquals($this->groupName1, $group['name']);
        $this->assertEquals('', $group['external_id']);
    }

    public function assertUpdateGroup()
    {
        $this->assertTrue($this->app->updateGroup(array(
            'group_id' => $this->groupId2,
            'name' => 'My Group C',
            'external_id' => 'something else',
        )));

        $group = $this->app->getGroup($this->groupId2);
        $this->assertNotEmpty($group);
        $this->assertEquals('My Group C', $group['name']);
        $this->assertEquals('something else', $group['external_id']);
    }

    public function assertRemove()
    {
        $this->assertTrue($this->app->removeGroup($this->groupId1));
    }
}