summaryrefslogtreecommitdiff
path: root/tests/integration/SwimlaneProcedureTest.php
blob: a3c2397a7f48a462db94262527ee59f03a460a90 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php

require_once __DIR__.'/BaseProcedureTest.php';

class SwimlaneProcedureTest extends BaseProcedureTest
{
    protected $projectName = 'My project to test swimlanes';
    private $swimlaneId = 0;

    public function testAll()
    {
        $this->assertCreateTeamProject();
        $this->assertAddSwimlane();
        $this->assertGetSwimlane();
        $this->assertUpdateSwimlane();
        $this->assertDisableSwimlane();
        $this->assertEnableSwimlane();
        $this->assertGetAllSwimlanes();
        $this->assertGetActiveSwimlane();
        $this->assertRemoveSwimlane();
        $this->assertChangePosition();
    }

    public function assertAddSwimlane()
    {
        $this->swimlaneId = $this->app->addSwimlane($this->projectId, 'Swimlane 1');
        $this->assertNotFalse($this->swimlaneId);
        $this->assertNotFalse($this->app->addSwimlane($this->projectId, 'Swimlane 2'));
    }

    public function assertGetSwimlane()
    {
        $swimlane = $this->app->getSwimlane($this->swimlaneId);
        $this->assertInternalType('array', $swimlane);
        $this->assertEquals('Swimlane 1', $swimlane['name']);
    }

    public function assertUpdateSwimlane()
    {
        $this->assertTrue($this->app->updateSwimlane($this->projectId, $this->swimlaneId, 'Another swimlane'));

        $swimlane = $this->app->getSwimlaneById($this->swimlaneId);
        $this->assertEquals('Another swimlane', $swimlane['name']);
    }

    public function assertDisableSwimlane()
    {
        $this->assertTrue($this->app->disableSwimlane($this->projectId, $this->swimlaneId));

        $swimlane = $this->app->getSwimlaneById($this->swimlaneId);
        $this->assertEquals(0, $swimlane['is_active']);
    }

    public function assertEnableSwimlane()
    {
        $this->assertTrue($this->app->enableSwimlane($this->projectId, $this->swimlaneId));

        $swimlane = $this->app->getSwimlaneById($this->swimlaneId);
        $this->assertEquals(1, $swimlane['is_active']);
    }

    public function assertGetAllSwimlanes()
    {
        $swimlanes = $this->app->getAllSwimlanes($this->projectId);
        $this->assertCount(3, $swimlanes);
        $this->assertEquals('Default swimlane', $swimlanes[0]['name']);
        $this->assertEquals('Swimlane 2', $swimlanes[1]['name']);
        $this->assertEquals('Another swimlane', $swimlanes[2]['name']);
    }

    public function assertGetActiveSwimlane()
    {
        $this->assertTrue($this->app->disableSwimlane($this->projectId, $this->swimlaneId));

        $swimlanes = $this->app->getActiveSwimlanes($this->projectId);
        $this->assertCount(2, $swimlanes);
        $this->assertEquals('Default swimlane', $swimlanes[0]['name']);
        $this->assertEquals('Swimlane 2', $swimlanes[1]['name']);
    }

    public function assertRemoveSwimlane()
    {
        $this->assertTrue($this->app->removeSwimlane($this->projectId, $this->swimlaneId));
    }

    public function assertChangePosition()
    {
        $swimlaneId1 = $this->app->addSwimlane($this->projectId, 'Swimlane A');
        $this->assertNotFalse($this->app->addSwimlane($this->projectId, 'Swimlane B'));

        $swimlanes = $this->app->getAllSwimlanes($this->projectId);
        $this->assertCount(4, $swimlanes);

        $this->assertTrue($this->app->changeSwimlanePosition($this->projectId, $swimlaneId1, 3));
    }
}