fix phpunit test

This commit is contained in:
DavidBadura 2015-04-22 11:32:43 +00:00
parent 188afd01ca
commit 9ba37c9d45
2 changed files with 21 additions and 14 deletions

View File

@ -254,19 +254,21 @@ class TaskManager
*/ */
private function edit(Task $task) private function edit(Task $task)
{ {
$this->taskwarrior->modify( $params = [
[ 'description' => $task->getDescription(),
'description' => $task->getDescription(), 'project' => $task->getProject(),
'project' => $task->getProject(), 'priority' => $task->getPriority(),
'priority' => $task->getPriority(), 'tags' => $task->getTags(),
'tags' => $task->getTags(), 'due' => $task->getDue() ? $task->getDue()->format('Ymd\THis\Z') : null,
'due' => $task->getDue() ? $task->getDue()->format('Ymd\THis\Z') : null, 'wait' => $task->getWait() ? $task->getWait()->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
'until' => $task->getUntil() ? $task->getUntil()->format('Ymd\THis\Z') : null, ];
'recur' => $task->getRecurring() ? $task->getRecurring()->getValue() : null,
], if ($task->getRecurring()) {
$task->getUuid() $params['recur'] = $task->getRecurring()->getValue();
); }
$this->taskwarrior->modify($params, $task->getUuid());
} }
/** /**

View File

@ -193,7 +193,10 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->taskManager->save($task1); $this->taskManager->save($task1);
$this->assertInstanceOf('DateTime', $task1->getEntry()); $this->assertInstanceOf('DateTime', $task1->getEntry());
$this->assertNull($task1->getModified()); $this->assertInstanceOf('DateTime', $task1->getModified());
$mod = $task1->getModified();
sleep(1);
$task1->setDescription('bar2'); $task1->setDescription('bar2');
@ -201,6 +204,8 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('DateTime', $task1->getEntry()); $this->assertInstanceOf('DateTime', $task1->getEntry());
$this->assertInstanceOf('DateTime', $task1->getModified()); $this->assertInstanceOf('DateTime', $task1->getModified());
$this->assertNotEquals($mod, $task1->getModified());
} }
public function testEnd() public function testEnd()