From 6e35d8f22aa828b9dcd72d749034754e1a00a525 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 14 Jul 2016 13:46:06 -0400 Subject: Display project name for task auto-complete fields --- .../Formatter/TaskAutoCompleteFormatterTest.php | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/units/Formatter/TaskAutoCompleteFormatterTest.php (limited to 'tests/units') diff --git a/tests/units/Formatter/TaskAutoCompleteFormatterTest.php b/tests/units/Formatter/TaskAutoCompleteFormatterTest.php new file mode 100644 index 00000000..20baf549 --- /dev/null +++ b/tests/units/Formatter/TaskAutoCompleteFormatterTest.php @@ -0,0 +1,34 @@ +container); + $taskCreationModel = new TaskCreationModel($this->container); + $taskFinderModel = new TaskFinderModel($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'My Project'))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Task 1', 'project_id' => 1))); + $this->assertEquals(2, $taskCreationModel->create(array('title' => 'Task 2', 'project_id' => 1))); + + $tasks = TaskAutoCompleteFormatter::getInstance($this->container) + ->withQuery($taskFinderModel->getExtendedQuery()) + ->format(); + + $this->assertCount(2, $tasks); + $this->assertEquals('My Project > #1 Task 1', $tasks[0]['label']); + $this->assertEquals('Task 1', $tasks[0]['value']); + $this->assertEquals(1, $tasks[0]['id']); + $this->assertEquals('My Project > #2 Task 2', $tasks[1]['label']); + $this->assertEquals('Task 2', $tasks[1]['value']); + $this->assertEquals(2, $tasks[1]['id']); + } +} -- cgit v1.2.3