diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-08-13 19:19:55 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-08-13 19:19:55 -0400 |
commit | 4520026e91ca0e601f48ff6f3a16f42354257f91 (patch) | |
tree | 7ece8a5426f94b57ae9cd602bb20fd80908f891c /tests | |
parent | 010199e8f846f6c0b4f23336338bfda17ec04901 (diff) |
Replace SQL query by a PicoDB query
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/Model/TaskFinderModelTest.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/units/Model/TaskFinderModelTest.php b/tests/units/Model/TaskFinderModelTest.php index b2e2bd84..a9f018ff 100644 --- a/tests/units/Model/TaskFinderModelTest.php +++ b/tests/units/Model/TaskFinderModelTest.php @@ -6,9 +6,70 @@ use Kanboard\Model\ColumnModel; use Kanboard\Model\TaskCreationModel; use Kanboard\Model\TaskFinderModel; use Kanboard\Model\ProjectModel; +use Kanboard\Model\TaskModel; class TaskFinderModelTest extends Base { + public function testGetDetails() + { + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + $projectModel = new ProjectModel($this->container); + $categoryModel = new \Kanboard\Model\CategoryModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1'))); + $this->assertEquals(1, $categoryModel->create(array('project_id' => 1, 'name' => 'C1'))); + $this->assertEquals(1, $taskCreationModel->create(array( + 'project_id' => 1, + 'title' => 'Task #1', + 'reference' => 'test', + 'description' => 'desc', + 'owner_id' => 1, + 'category_id' => 1, + ))); + + $task = $taskFinderModel->getDetails(1); + $this->assertEquals(1, $task['id']); + $this->assertEquals('test', $task['reference']); + $this->assertEquals('Task #1', $task['title']); + $this->assertEquals('desc', $task['description']); + $this->assertEquals(time(), $task['date_creation'], 'Delta', 1); + $this->assertEquals(time(), $task['date_modification'], 'Delta', 1); + $this->assertEquals(time(), $task['date_moved'], 'Delta', 1); + $this->assertEquals(0, $task['date_completed']); + $this->assertEquals(0, $task['date_due']); + $this->assertEquals(0, $task['date_started']); + $this->assertEquals(0, $task['time_estimated']); + $this->assertEquals(0, $task['time_spent']); + $this->assertEquals('yellow', $task['color_id']); + $this->assertEquals(1, $task['project_id']); + $this->assertEquals(1, $task['column_id']); + $this->assertEquals(1, $task['owner_id']); + $this->assertEquals(0, $task['creator_id']); + $this->assertEquals(1, $task['position']); + $this->assertEquals(TaskModel::STATUS_OPEN, $task['is_active']); + $this->assertEquals(0, $task['score']); + $this->assertEquals(1, $task['category_id']); + $this->assertEquals(0, $task['priority']); + $this->assertEquals(0, $task['swimlane_id']); + $this->assertEquals(TaskModel::RECURRING_STATUS_NONE, $task['recurrence_status']); + $this->assertEquals(TaskModel::RECURRING_TRIGGER_FIRST_COLUMN, $task['recurrence_trigger']); + $this->assertEquals(0, $task['recurrence_factor']); + $this->assertEquals(TaskModel::RECURRING_TIMEFRAME_DAYS, $task['recurrence_timeframe']); + $this->assertEquals(TaskModel::RECURRING_BASEDATE_DUEDATE, $task['recurrence_basedate']); + $this->assertEquals(0, $task['recurrence_parent']); + $this->assertEquals(0, $task['recurrence_child']); + $this->assertEquals('C1', $task['category_name']); + $this->assertNull($task['swimlane_name']); + $this->assertEquals('Default swimlane', $task['default_swimlane']); + $this->assertEquals('Project #1', $task['project_name']); + $this->assertEquals('Backlog', $task['column_title']); + $this->assertEquals('admin', $task['assignee_username']); + $this->assertEquals('', $task['assignee_name']); + $this->assertEquals('', $task['creator_username']); + $this->assertEquals('', $task['creator_name']); + } + public function testGetTasksForDashboardWithHiddenColumn() { $taskCreationModel = new TaskCreationModel($this->container); |