diff options
Diffstat (limited to 'tests/units/Model/TaskTest.php')
-rw-r--r-- | tests/units/Model/TaskTest.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/units/Model/TaskTest.php b/tests/units/Model/TaskTest.php index ebafa612..37c68a78 100644 --- a/tests/units/Model/TaskTest.php +++ b/tests/units/Model/TaskTest.php @@ -26,4 +26,39 @@ class TaskTest extends Base $this->assertTrue($t->remove(1)); $this->assertFalse($t->remove(1234)); } + + public function testGetTaskIdFromText() + { + $t = new Task($this->container); + $this->assertEquals(123, $t->getTaskIdFromText('My task #123')); + $this->assertEquals(0, $t->getTaskIdFromText('My task 123')); + } + + public function testRecurrenceSettings() + { + $t = new Task($this->container); + + $statuses = $t->getRecurrenceStatusList(); + $this->assertCount(2, $statuses); + $this->assertArrayHasKey(Task::RECURRING_STATUS_NONE, $statuses); + $this->assertArrayHasKey(Task::RECURRING_STATUS_PENDING, $statuses); + $this->assertArrayNotHasKey(Task::RECURRING_STATUS_PROCESSED, $statuses); + + $triggers = $t->getRecurrenceTriggerList(); + $this->assertCount(3, $triggers); + $this->assertArrayHasKey(Task::RECURRING_TRIGGER_FIRST_COLUMN, $triggers); + $this->assertArrayHasKey(Task::RECURRING_TRIGGER_LAST_COLUMN, $triggers); + $this->assertArrayHasKey(Task::RECURRING_TRIGGER_CLOSE, $triggers); + + $dates = $t->getRecurrenceBasedateList(); + $this->assertCount(2, $dates); + $this->assertArrayHasKey(Task::RECURRING_BASEDATE_DUEDATE, $dates); + $this->assertArrayHasKey(Task::RECURRING_BASEDATE_TRIGGERDATE, $dates); + + $timeframes = $t->getRecurrenceTimeframeList(); + $this->assertCount(3, $timeframes); + $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_DAYS, $timeframes); + $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_MONTHS, $timeframes); + $this->assertArrayHasKey(Task::RECURRING_TIMEFRAME_YEARS, $timeframes); + } } |