Merge pull request #29 from tolry/allow-dots-in-projects-and-tasks

allow dots in projects and tags
This commit is contained in:
David Badura 2015-07-29 09:46:52 +02:00
commit 1495e8bcc1
2 changed files with 32 additions and 3 deletions

View File

@ -24,10 +24,11 @@ use ProxyManager\Proxy\ValueHolderInterface;
/**
* @author David Badura <d.a.badura@gmail.com>
* @author Tobias Olry <tobias.olry@gmail.com>
*/
class TaskManager
{
const PATTERN = '/^[\wäüö]*$/i';
const PATTERN = '/^[\wäüö\.]*$/i';
/**
* @var Taskwarrior

View File

@ -9,7 +9,8 @@ use DavidBadura\Taskwarrior\Taskwarrior;
use Symfony\Component\Filesystem\Filesystem;
/**
* @author David Badura <badura@simplethings.de>
* @author David Badura <d.a.badura@gmail.com>
* @author Tobias Olry <tobias.olry@gmail.com>
*/
class TaskManagerTest extends \PHPUnit_Framework_TestCase
{
@ -548,7 +549,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array('später'), $task1->getTags());
$this->assertEquals(array('später'), $this->taskwarrior->tags());
$this->assertCount(1,$this->taskManager->filterPending('+später'));
$this->assertCount(1, $this->taskManager->filterPending('+später'));
}
public function testTagNameNotAllowed()
@ -563,6 +564,33 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->taskManager->save($task1);
}
public function provideProjectNames()
{
return [
['grandparent.parent.child'],
['parent.child'],
];
}
/**
* @dataProvider provideProjectNames
*/
public function testProjectHierarchyAllowed($project)
{
$task = new Task();
$task->setDescription('foo1');
$task->setProject($project);
// no exception thrown
$this->taskManager->save($task);
// refetch the task
$this->taskManager->clear();
$task = $this->taskManager->find($task->getUuid());
$this->assertEquals($project, $task->getProject());
}
public function testWait()
{
$task1 = new Task();