From ff17be571438f72312285e7a47f6214453d95394 Mon Sep 17 00:00:00 2001 From: DavidBadura Date: Sat, 12 Mar 2016 10:23:18 +0000 Subject: [PATCH] prepare version 3.0 --- .travis.yml | 7 ++++++- README.md | 35 ++++++++++++++++++++++++++++++++++- tests/TaskManagerTest.php | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee6fdde..b3f5b77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,12 +25,17 @@ php: env: global: - - TASKWARRIOR=2.5.0 + - TASKWARRIOR=2.5.1 matrix: - PREFER_LOWEST="--prefer-lowest" - PREFER_LOWEST="" matrix: + include: + - php: 7 + env: TASKWARRIOR=2.5.0 + - php: 5.6 + env: TASKWARRIOR=2.5.0 allow_failures: - php: hhvm diff --git a/README.md b/README.md index e3d05c9..b347eaa 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,12 @@ Unfortunately, the annotation reader is not automatically registered on composer ## Requirements Taskwarrior changes its behavior by patch level updates and it is very difficult to support all versions. -The current supported versions are: **>=2.4.3** +The current supported versions are: + +|PHP Lib|Taskwarrior|PHP Version| +|----|---------|------| +|2.x|>=2.4.3|>=5.4| +|3.x|>=2.5.0|>=5.5| ## Usage @@ -29,6 +34,7 @@ The current supported versions are: **>=2.4.3** use DavidBadura\Taskwarrior\TaskManager; use DavidBadura\Taskwarrior\Task; use DavidBadura\Taskwarrior\Recurring; +use DavidBadura\Taskwarrior\Annotation; $tm = TaskManager::create(); @@ -39,6 +45,7 @@ $task->setDue('tomorrow'); $task->setPriority(Task::PRIORITY_HIGH); $task->addTag('next'); $task->setRecurring(Recurring::DAILY); +$task->addAnnotation(new Annotation("and add many features")); $tm->save($task); @@ -65,6 +72,7 @@ $tasks = $tm->filterByReport('waiting'); // and sorting |due|true|DateTime| |wait|true|DateTime| |tags|true|string[]| +|annotations|true|Annotation[]| |urgency|false|float| |entry|false|DateTime| |start|false|DateTime| @@ -127,6 +135,15 @@ $tasks = $tm->filterPending('project:hobby and +home'); $tasks = $tm->filterPending(['project:hobby', '+home']); ``` +count tasks: + +```php +$tasks = $tm->count('status:pending'); +$tasks = $tm->count('status:pending +home'); +$tasks = $tm->count('status:pending and +home'); +$tasks = $tm->count(['status:pending', '+home']); +``` + delete task: ```php @@ -179,6 +196,22 @@ $task2 = $task1->getDependencies()[0]; echo $task2->getDesciption(); // "b" <- lazy loading ``` +annotations: + +```php +$task = new Task(); +$task->setDescription('a'); +$task->addAnnotation(new Annotation("foobar")); + +$tm->save($task); + +$tm->clear(); // clear object cache + +$task = $tm->find('uuid-from-task1'); +$annotation = $task->getAnnotations()[0]; +echo $annotation->getDesciption(); // "foobar" +``` + ### QueryBuilder example: diff --git a/tests/TaskManagerTest.php b/tests/TaskManagerTest.php index ea2d379..8b902ed 100644 --- a/tests/TaskManagerTest.php +++ b/tests/TaskManagerTest.php @@ -965,7 +965,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase $this->assertEquals('blabla', $annotations[1]->getDescription()); $task->removeAnnotation($annotations[0]); - + $this->taskManager->save($task); $task = $this->taskManager->find($task->getUuid());