diff --git a/.travis.yml b/.travis.yml index a28516b..8f117f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,17 @@ env: - PREFER_LOWEST="" before_install: - - sudo add-apt-repository ppa:ultrafredde/ppa -y - - sudo apt-get update -qq - - sudo apt-get install -qq task --force-yes + - wget http://taskwarrior.org/download/task-2.4.2.tar.gz + - gunzip task-2.4.2.tar.gz + - tar xf task-2.4.2.tar + - cd task-2.4.2 + - sudo apt-get install cmake build-essential uuid-dev libgnutls-dev libreadline6-dev --force-yes + - sudo cmake -DCMAKE_BUILD_TYPE=release . + - sudo make + - sudo make install + - sudo ln -s /usr/local/bin/task /usr/bin/task - task --version + - cd .. before_script: - composer self-update diff --git a/src/TaskManager.php b/src/TaskManager.php index 316e1bd..b30c397 100644 --- a/src/TaskManager.php +++ b/src/TaskManager.php @@ -255,19 +255,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 f01cc1e..65400a7 100644 --- a/tests/TaskManagerTest.php +++ b/tests/TaskManagerTest.php @@ -196,7 +196,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(2); $task1->setDescription('bar2'); @@ -204,6 +207,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()