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
|
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class ColumnProcedureTest extends BaseProcedureTest
{
protected $projectName = 'My project to test columns';
private $columns = array();
public function testAll()
{
$this->assertCreateTeamProject();
$this->assertGetColumns();
$this->assertUpdateColumn();
$this->assertAddColumn();
$this->assertRemoveColumn();
$this->assertChangeColumnPosition();
}
public function assertGetColumns()
{
$this->columns = $this->app->getColumns($this->projectId);
$this->assertCount(4, $this->columns);
$this->assertEquals('Done', $this->columns[3]['title']);
}
public function assertUpdateColumn()
{
$this->assertTrue($this->app->updateColumn($this->columns[3]['id'], 'Another column', 2));
$this->columns = $this->app->getColumns($this->projectId);
$this->assertEquals('Another column', $this->columns[3]['title']);
$this->assertEquals(2, $this->columns[3]['task_limit']);
}
public function assertAddColumn()
{
$column_id = $this->app->addColumn($this->projectId, 'New column');
$this->assertNotFalse($column_id);
$this->assertTrue($column_id > 0);
$this->columns = $this->app->getColumns($this->projectId);
$this->assertCount(5, $this->columns);
$this->assertEquals('New column', $this->columns[4]['title']);
}
public function assertRemoveColumn()
{
$this->assertTrue($this->app->removeColumn($this->columns[3]['id']));
$this->columns = $this->app->getColumns($this->projectId);
$this->assertCount(4, $this->columns);
}
public function assertChangeColumnPosition()
{
$this->assertTrue($this->app->changeColumnPosition($this->projectId, $this->columns[0]['id'], 3));
$this->columns = $this->app->getColumns($this->projectId);
$this->assertEquals('Ready', $this->columns[0]['title']);
$this->assertEquals(1, $this->columns[0]['position']);
$this->assertEquals('Work in progress', $this->columns[1]['title']);
$this->assertEquals(2, $this->columns[1]['position']);
$this->assertEquals('Backlog', $this->columns[2]['title']);
$this->assertEquals(3, $this->columns[2]['position']);
$this->assertEquals('New column', $this->columns[3]['title']);
$this->assertEquals(4, $this->columns[3]['position']);
}
}
|