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

require_once __DIR__.'/BaseProcedureTest.php';

class TaskMetadataProcedureTest extends BaseProcedureTest
{
    protected $projectName = 'My project to test tasks metadata';
    protected $metaKey = 'MyTestMetaKey';

    public function testAll()
    {
        $this->assertCreateTeamProject();
        $this->assertCreateTask();
        $this->assertSaveTaskMetadata();
        $this->assertGetTaskMetadata();
        $this->assertGetTaskMetadataByName();
        $this->assertRemoveTaskMetadata();
    }

    public function assertSaveTaskMetadata()
    {
        $this->assertTrue($this->app->saveTaskMetadata($this->taskId, array($this->metaKey => 'metaValue1')));
    }

    public function assertGetTaskMetadata()
    {
        $metaData = $this->app->getTaskMetadata(($this->taskId));
        $this->assertArrayHasKey($this->metaKey, $metaData);
        $this->assertEquals('metaValue1', $metaData[$this->metaKey]);
    }

    public function assertGetTaskMetadataByName()
    {
        $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey);
        $this->assertEquals('metaValue1', $metaValue, 'Did not return correct metadata value');
    }

    public function assertRemoveTaskMetadata()
    {
        $result = $this->app->removeTaskMetadata($this->taskId, $this->metaKey);
        $this->assertTrue($result, 'Did not remove metakey with success');
        $metaValue = $this->app->getTaskMetadataByName($this->taskId, $this->metaKey);
        $this->assertEquals('', $metaValue, 'Did not return an empty string due to metadata being deleted');
    }
}