From d18a3acca8d8fd1a30ea7fe742bf93dfa134edfd Mon Sep 17 00:00:00 2001 From: Tobias Olry Date: Sat, 25 Jul 2015 11:02:18 +0200 Subject: [PATCH] allow dots in projects and tasks --- src/TaskManager.php | 3 ++- tests/TaskManagerTest.php | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/TaskManager.php b/src/TaskManager.php index df091b8..1c5e06c 100644 --- a/src/TaskManager.php +++ b/src/TaskManager.php @@ -24,10 +24,11 @@ use ProxyManager\Proxy\ValueHolderInterface; /** * @author David Badura + * @author Tobias Olry */ class TaskManager { - const PATTERN = '/^[\wäüö]*$/i'; + const PATTERN = '/^[\wäüö\.]*$/i'; /** * @var Taskwarrior diff --git a/tests/TaskManagerTest.php b/tests/TaskManagerTest.php index c6e0fed..be5d351 100644 --- a/tests/TaskManagerTest.php +++ b/tests/TaskManagerTest.php @@ -9,7 +9,8 @@ use DavidBadura\Taskwarrior\Taskwarrior; use Symfony\Component\Filesystem\Filesystem; /** - * @author David Badura + * @author David Badura + * @author Tobias Olry */ 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,21 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase $this->taskManager->save($task1); } + public function testProjectHierarchyAllowed() + { + $projects = ['grandparent.parent.child', 'parent.child']; + foreach ($projects as $project) { + $task = new Task(); + $task->setDescription('foo1'); + $task->setProject($project); + + // now exception thrown + $this->taskManager->save($task); + + $this->assertEquals($project, $task->getProject()); + } + } + public function testWait() { $task1 = new Task();