blob: 7ab4ef0ba000b7e3d77bc847287cf82ebb55442e (
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
|
<?php
require_once __DIR__.'/BaseProcedureTest.php';
class SubtaskProcedureTest extends BaseProcedureTest
{
protected $projectName = 'My project to test subtasks';
private $subtaskId = 0;
public function testAll()
{
$this->assertCreateTeamProject();
$this->assertCreateTask();
$this->assertCreateSubtask();
$this->assertGetSubtask();
$this->assertUpdateSubtask();
$this->assertGetAllSubtasks();
$this->assertRemoveSubtask();
}
public function assertCreateSubtask()
{
$this->subtaskId = $this->app->createSubtask(array(
'task_id' => $this->taskId,
'title' => 'subtask #1',
));
$this->assertNotFalse($this->subtaskId);
}
public function assertGetSubtask()
{
$subtask = $this->app->getSubtask($this->subtaskId);
$this->assertEquals($this->taskId, $subtask['task_id']);
$this->assertEquals('subtask #1', $subtask['title']);
}
public function assertUpdateSubtask()
{
$this->assertTrue($this->app->execute('updateSubtask', array(
'id' => $this->subtaskId,
'task_id' => $this->taskId,
'title' => 'test',
)));
$subtask = $this->app->getSubtask($this->subtaskId);
$this->assertEquals('test', $subtask['title']);
}
public function assertGetAllSubtasks()
{
$subtasks = $this->app->getAllSubtasks($this->taskId);
$this->assertCount(1, $subtasks);
$this->assertEquals('test', $subtasks[0]['title']);
}
public function assertRemoveSubtask()
{
$this->assertTrue($this->app->removeSubtask($this->subtaskId));
$subtasks = $this->app->getAllSubtasks($this->taskId);
$this->assertCount(0, $subtasks);
}
}
|