fix description

This commit is contained in:
DavidBadura 2015-06-28 13:11:00 +00:00
parent d6c82c04e7
commit fb763a765e
3 changed files with 26 additions and 17 deletions

View File

@ -22,7 +22,8 @@
"doctrine/collections": "~1.3" "doctrine/collections": "~1.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "phpunit/phpunit": "~4.0",
"symfony/var-dumper": "~2.6"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -180,7 +180,7 @@ class Taskwarrior
if ($filter) { if ($filter) {
foreach($filter as $f) { foreach($filter as $f) {
$parts[] = "( " . $f . ' )'; $parts[] = "( " . $f . " )";
} }
} }
@ -270,7 +270,7 @@ class Taskwarrior
} }
if (array_key_exists('description', $params)) { if (array_key_exists('description', $params)) {
$options[] = $params['description']; $options[] = 'description:' . $params['description'];
} }
return $options; return $options;

View File

@ -69,30 +69,38 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($task, $result); $this->assertEquals($task, $result);
} }
public function testUrlInDescription() public function provideDescriptions()
{ {
$task = new Task(); return array(
$task->setDescription('hier http://google.de '); array('hier http://google.de'),
array("test ' foo"),
$this->taskManager->save($task); array("test (foo) bar"),
$this->taskManager->clear(); array("foo-bar"),
array("test +bar")
$result = $this->taskManager->find($task->getUuid()); );
$this->assertEquals('hier http://google.de ', $result->getDescription());
} }
public function testQuoteInDescription() /**
* @dataProvider provideDescriptions
*/
public function testDescription($description)
{ {
$task = new Task(); $task = new Task();
$task->setDescription(" test ' foo "); $task->setDescription($description);
$this->taskManager->save($task); $this->taskManager->save($task);
$this->taskManager->clear(); $this->taskManager->clear();
$result = $this->taskManager->find($task->getUuid()); $task = $this->taskManager->find($task->getUuid());
$this->assertEquals(" test ' foo ", $result->getDescription()); $this->assertEquals($description, $task->getDescription());
$this->taskManager->save($task);
$this->taskManager->clear();
$task = $this->taskManager->find($task->getUuid());
$this->assertEquals($description, $task->getDescription());
} }
public function testSaveTaskWithoutDescription() public function testSaveTaskWithoutDescription()