summaryrefslogtreecommitdiff
path: root/tests/integration/ColumnTest.php
blob: 6d02afc0cffb1fce69480656faa9a0a11700a0e5 (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
65
<?php

require_once __DIR__.'/Base.php';

class ColumnTest extends Base
{
    public function testCreateProject()
    {
        $this->assertEquals(1, $this->app->createProject('A project'));
    }

    public function testGetColumns()
    {
        $columns = $this->app->getColumns($this->getProjectId());
        $this->assertCount(4, $columns);
        $this->assertEquals('Done', $columns[3]['title']);
    }

    public function testUpdateColumn()
    {
        $this->assertTrue($this->app->updateColumn(4, 'Boo', 2));

        $columns = $this->app->getColumns($this->getProjectId());
        $this->assertEquals('Boo', $columns[3]['title']);
        $this->assertEquals(2, $columns[3]['task_limit']);
    }

    public function testAddColumn()
    {
        $column_id = $this->app->addColumn($this->getProjectId(), 'New column');

        $this->assertNotFalse($column_id);
        $this->assertInternalType('int', $column_id);
        $this->assertTrue($column_id > 0);

        $columns = $this->app->getColumns($this->getProjectId());
        $this->assertCount(5, $columns);
        $this->assertEquals('New column', $columns[4]['title']);
    }

    public function testRemoveColumn()
    {
        $this->assertTrue($this->app->removeColumn(5));

        $columns = $this->app->getColumns($this->getProjectId());
        $this->assertCount(4, $columns);
    }

    public function testChangeColumnPosition()
    {
        $this->assertTrue($this->app->changeColumnPosition($this->getProjectId(), 1, 3));

        $columns = $this->app->getColumns($this->getProjectId());
        $this->assertCount(4, $columns);

        $this->assertEquals('Ready', $columns[0]['title']);
        $this->assertEquals(1, $columns[0]['position']);
        $this->assertEquals('Work in progress', $columns[1]['title']);
        $this->assertEquals(2, $columns[1]['position']);
        $this->assertEquals('Backlog', $columns[2]['title']);
        $this->assertEquals(3, $columns[2]['position']);
        $this->assertEquals('Boo', $columns[3]['title']);
        $this->assertEquals(4, $columns[3]['position']);
    }
}