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

require_once __DIR__.'/BaseProcedureTest.php';

class TagProcedureTest extends BaseProcedureTest
{
    protected $projectName = 'My project with tags';

    public function testAll()
    {
        $this->assertCreateTeamProject();
        $this->assertCreateTag();
        $this->assertGetProjectTags();
        $this->assertGetAllTags();
        $this->assertUpdateTag();
        $this->assertRemoveTag();
    }

    public function assertCreateTag()
    {
        $this->assertNotFalse($this->app->createTag($this->projectId, 'some tag'));
    }

    public function assertGetProjectTags()
    {
        $tags = $this->app->getTagsByProject($this->projectId);
        $this->assertCount(1, $tags);
        $this->assertEquals('some tag', $tags[0]['name']);
    }

    public function assertGetAllTags()
    {
        $tags = $this->app->getAllTags();
        $this->assertCount(1, $tags);
        $this->assertEquals('some tag', $tags[0]['name']);
    }

    public function assertUpdateTag()
    {
        $tags = $this->app->getAllTags();
        $this->assertCount(1, $tags);
        $this->assertTrue($this->app->updateTag($tags[0]['id'], 'another tag'));

        $tags = $this->app->getAllTags();
        $this->assertCount(1, $tags);
        $this->assertEquals('another tag', $tags[0]['name']);
    }

    public function assertRemoveTag()
    {
        $tags = $this->app->getAllTags();
        $this->assertCount(1, $tags);
        $this->assertTrue($this->app->removeTag($tags[0]['id']));

        $tags = $this->app->getAllTags();
        $this->assertCount(0, $tags);
    }
}