summaryrefslogtreecommitdiff
path: root/tests/integration/OverdueTaskProcedureTest.php
blob: 0e31afa05eb94374ded872cfa8aebc34c7f25f5f (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
<?php

require_once __DIR__.'/BaseProcedureTest.php';

class OverdueTaskProcedureTest extends BaseProcedureTest
{
    protected $projectName = 'My project to test overdue tasks';

    public function testAll()
    {
        $this->assertCreateTeamProject();
        $this->assertCreateOverdueTask();
        $this->assertGetOverdueTasksByProject();
        $this->assertGetOverdueTasks();
    }

    public function assertCreateOverdueTask()
    {
        $this->assertNotFalse($this->app->createTask(array(
            'title' => 'overdue task',
            'project_id' => $this->projectId,
            'date_due' => date('Y-m-d H:i', strtotime('-2days')),
        )));
    }

    public function assertGetOverdueTasksByProject()
    {
        $tasks = $this->app->getOverdueTasksByProject($this->projectId);
        $this->assertNotEmpty($tasks);
        $this->assertCount(1, $tasks);
        $this->assertEquals('overdue task', $tasks[0]['title']);
        $this->assertEquals($this->projectName, $tasks[0]['project_name']);
    }

    public function assertGetOverdueTasks()
    {
        $tasks = $this->app->getOverdueTasks();
        $this->assertNotEmpty($tasks);
        $this->assertCount(1, $tasks);
        $this->assertEquals('overdue task', $tasks[0]['title']);
        $this->assertEquals($this->projectName, $tasks[0]['project_name']);
    }
}