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"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "~4.0",
"symfony/var-dumper": "~2.6"
},
"autoload": {
"psr-4": {

View File

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

View File

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