summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-25 17:07:07 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-25 17:07:07 -0400
commit7f33cf6ef5f3fbe576c3d56813447eed91de75bd (patch)
tree71e8a9ea45ccd5a67ce36126f39bb4f41fd87137 /tests
parentc5481618a723599dea8f0686d2714a842e5ebb45 (diff)
Fix bug: avoid the creation of multiple subtask timer for the same task and user
Diffstat (limited to 'tests')
-rw-r--r--tests/units/SubtaskTimeTrackingTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/units/SubtaskTimeTrackingTest.php b/tests/units/SubtaskTimeTrackingTest.php
index 94359159..27ba7c7d 100644
--- a/tests/units/SubtaskTimeTrackingTest.php
+++ b/tests/units/SubtaskTimeTrackingTest.php
@@ -13,6 +13,25 @@ use Core\Session;
class SubtaskTimeTrackingTest extends Base
{
+ public function testHasTimer()
+ {
+ $tc = new TaskCreation($this->container);
+ $s = new Subtask($this->container);
+ $st = new SubtaskTimeTracking($this->container);
+ $p = new Project($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test1')));
+ $this->assertEquals(1, $tc->create(array('title' => 'test 1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1)));
+ $this->assertEquals(1, $s->create(array('title' => 'subtask #2', 'task_id' => 1, 'user_id' => 1)));
+
+ $this->assertFalse($st->hasTimer(1, 1));
+ $this->assertTrue($st->logStartTime(1, 1));
+ $this->assertTrue($st->hasTimer(1, 1));
+ $this->assertFalse($st->logStartTime(1, 1));
+ $this->assertTrue($st->logEndTime(1, 1));
+ $this->assertFalse($st->hasTimer(1, 1));
+ }
+
public function testGetTimerStatus()
{
$tc = new TaskCreation($this->container);