From 4a87fb34ba0a88303282923a73a8fef83d7aada3 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 26 Feb 2017 15:18:49 -0500 Subject: Display tags in task list view --- tests/units/Formatter/TaskListFormatterTest.php | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/units/Formatter/TaskListFormatterTest.php (limited to 'tests/units/Formatter') diff --git a/tests/units/Formatter/TaskListFormatterTest.php b/tests/units/Formatter/TaskListFormatterTest.php new file mode 100644 index 00000000..f1b78a22 --- /dev/null +++ b/tests/units/Formatter/TaskListFormatterTest.php @@ -0,0 +1,60 @@ +container); + $taskFinderModel = new TaskFinderModel($this->container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskTagModel = new TaskTagModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Test'))); + $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test1'))); + $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test2', 'column_id' => 3))); + $this->assertEquals(3, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test3'))); + + $this->assertTrue($taskTagModel->save(1, 1, array('My tag 1', 'My tag 2'))); + $this->assertTrue($taskTagModel->save(1, 2, array('My tag 3'))); + + $listing = TaskListFormatter::getInstance($this->container) + ->withQuery($taskFinderModel->getExtendedQuery()) + ->format(); + + $this->assertCount(3, $listing); + + $expected = array( + array( + 'id' => 1, + 'name' => 'My tag 1', + 'task_id' => 1, + ), + array( + 'id' => 2, + 'name' => 'My tag 2', + 'task_id' => 1, + ), + ); + + $this->assertEquals($expected, $listing[0]['tags']); + + $expected = array( + array( + 'id' => 3, + 'name' => 'My tag 3', + 'task_id' => 2, + ), + ); + + $this->assertEquals($expected, $listing[1]['tags']); + $this->assertEquals(array(), $listing[2]['tags']); + } +} \ No newline at end of file -- cgit v1.2.3