summaryrefslogtreecommitdiff
path: root/tests/integration/MeProcedureTest.php
blob: ed471b1b679f496df8b49972d5d68da974c277fb (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

require_once __DIR__.'/BaseProcedureTest.php';

class MeProcedureTest extends BaseProcedureTest
{
    protected $projectName = 'My private project';

    public function testAll()
    {
        $this->assertGetMe();
        $this->assertCreateMyPrivateProject();
        $this->assertGetMyProjectsList();
        $this->assertGetMyProjects();
        $this->assertCreateTask();
        $this->assertGetMyDashboard();
        $this->assertGetMyActivityStream();
    }

    public function assertGetMe()
    {
        $profile = $this->user->getMe();
        $this->assertEquals('user', $profile['username']);
        $this->assertEquals('app-user', $profile['role']);
    }

    public function assertCreateMyPrivateProject()
    {
        $this->projectId = $this->user->createMyPrivateProject($this->projectName);
        $this->assertNotFalse($this->projectId);
    }

    public function assertGetMyProjectsList()
    {
        $projects = $this->user->getMyProjectsList();
        $this->assertNotEmpty($projects);
        $this->assertEquals($this->projectName, $projects[$this->projectId]);
    }

    public function assertGetMyProjects()
    {
        $projects = $this->user->getMyProjects();
        $this->assertNotEmpty($projects);
    }

    public function assertCreateTask()
    {
        $taskId = $this->user->createTask(array('title' => 'My task', 'project_id' => $this->projectId, 'owner_id' => $this->userUserId));
        $this->assertNotFalse($taskId);
    }

    public function assertGetMyDashboard()
    {
        $dashboard = $this->user->getMyDashboard();
        $this->assertNotEmpty($dashboard);
        $this->assertEquals('My task', $dashboard[0]['title']);
    }

    public function assertGetMyActivityStream()
    {
        $activity = $this->user->getMyActivityStream();
        $this->assertNotEmpty($activity);
    }
}