diff --git a/src/TaskManager.php b/src/TaskManager.php index 802dc00..876de86 100644 --- a/src/TaskManager.php +++ b/src/TaskManager.php @@ -254,19 +254,21 @@ class TaskManager */ private function edit(Task $task) { - $this->taskwarrior->modify( - [ - 'description' => $task->getDescription(), - 'project' => $task->getProject(), - 'priority' => $task->getPriority(), - 'tags' => $task->getTags(), - 'due' => $task->getDue() ? $task->getDue()->format('Ymd\THis\Z') : null, - 'wait' => $task->getWait() ? $task->getWait()->format('Ymd\THis\Z') : null, - 'until' => $task->getUntil() ? $task->getUntil()->format('Ymd\THis\Z') : null, - 'recur' => $task->getRecurring() ? $task->getRecurring()->getValue() : null, - ], - $task->getUuid() - ); + $params = [ + 'description' => $task->getDescription(), + 'project' => $task->getProject(), + 'priority' => $task->getPriority(), + 'tags' => $task->getTags(), + 'due' => $task->getDue() ? $task->getDue()->format('Ymd\THis\Z') : null, + 'wait' => $task->getWait() ? $task->getWait()->format('Ymd\THis\Z') : null, + 'until' => $task->getUntil() ? $task->getUntil()->format('Ymd\THis\Z') : null + ]; + + if ($task->getRecurring()) { + $params['recur'] = $task->getRecurring()->getValue(); + } + + $this->taskwarrior->modify($params, $task->getUuid()); } /** diff --git a/tests/TaskManagerTest.php b/tests/TaskManagerTest.php index 0dbcf66..a50a470 100644 --- a/tests/TaskManagerTest.php +++ b/tests/TaskManagerTest.php @@ -193,7 +193,10 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase $this->taskManager->save($task1); $this->assertInstanceOf('DateTime', $task1->getEntry()); - $this->assertNull($task1->getModified()); + $this->assertInstanceOf('DateTime', $task1->getModified()); + + $mod = $task1->getModified(); + sleep(1); $task1->setDescription('bar2'); @@ -201,6 +204,8 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('DateTime', $task1->getEntry()); $this->assertInstanceOf('DateTime', $task1->getModified()); + + $this->assertNotEquals($mod, $task1->getModified()); } public function testEnd()