diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-25 14:34:46 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-25 14:34:46 -0400 |
commit | 922e0fb6de06a98774418612e0b0f75af72b6dbb (patch) | |
tree | dff0b7c2c8cd0515b22c8f320cdcf58c47515a98 /tests/integration/SubtaskTest.php | |
parent | fc93203e4db044d37c1686fef0efb1ac1d6ac4b8 (diff) |
Rewrite integration tests to run with Docker containers
Diffstat (limited to 'tests/integration/SubtaskTest.php')
-rw-r--r-- | tests/integration/SubtaskTest.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/integration/SubtaskTest.php b/tests/integration/SubtaskTest.php new file mode 100644 index 00000000..10082e60 --- /dev/null +++ b/tests/integration/SubtaskTest.php @@ -0,0 +1,64 @@ +<?php + +require_once __DIR__.'/BaseIntegrationTest.php'; + +class SubtaskTest extends BaseIntegrationTest +{ + 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); + } +} |