rewrite
This commit is contained in:
parent
4ebaee91aa
commit
da2d664f58
121
README.md
121
README.md
@ -10,7 +10,7 @@
|
|||||||
composer require 'davidbadura/taskwarrior'
|
composer require 'davidbadura/taskwarrior'
|
||||||
```
|
```
|
||||||
|
|
||||||
**Requirements: Taskwarrior >=2.1**
|
**Requirements: Taskwarrior >=2.4**
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -31,21 +31,132 @@ $task->setRecurring(Recurring::DAILY);
|
|||||||
|
|
||||||
$tm->save($task);
|
$tm->save($task);
|
||||||
|
|
||||||
$tasks = $tm->filter('project:hobby'); // one task
|
$tasks = $tm->filterPending('project:hobby'); // one task
|
||||||
|
|
||||||
$tm->done($task);
|
$tm->done($task);
|
||||||
|
|
||||||
$tasks = $tm->filter('project:hobby'); // empty
|
$tasks = $tm->filterPending('project:hobby'); // empty
|
||||||
|
$tasks = $tm->filter('project:hobby'); // one task
|
||||||
|
|
||||||
$tasks = $tm->filterByReport('waiting');
|
$tasks = $tm->filterByReport('waiting'); // and sorting
|
||||||
```
|
```
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
todo...
|
### Task
|
||||||
|
|
||||||
|
|attr|writeable|type|
|
||||||
|
|----|---------|----|
|
||||||
|
|uuid|false|string|
|
||||||
|
|description|true|string|
|
||||||
|
|priority|true|string|
|
||||||
|
|project|true|string|
|
||||||
|
|due|true|DateTime|
|
||||||
|
|wait|true|DateTime|
|
||||||
|
|tags|true|string[]|
|
||||||
|
|urgency|false|float|
|
||||||
|
|entry|false|DateTime|
|
||||||
|
|start|false|DateTime|
|
||||||
|
|recur|true|Recurring|
|
||||||
|
|unti|true|DateTime|
|
||||||
|
|modified|false|DateTime|
|
||||||
|
|end|false|DateTime|
|
||||||
|
|status|false|string|
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$task = new Task();
|
||||||
|
$task->setDescription('program this lib');
|
||||||
|
$task->setProject('hobby');
|
||||||
|
$task->setDue('tomorrow');
|
||||||
|
$task->setPriority(Task::PRIORITY_HIGH);
|
||||||
|
$task->addTag('next');
|
||||||
|
$task->setRecurring(Recurring::DAILY);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Taskwarrior
|
||||||
|
|
||||||
|
create TaskManager:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm = TaskManager::create();
|
||||||
|
```
|
||||||
|
|
||||||
|
save a task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$task = new Task();
|
||||||
|
$task->setDescription('foo');
|
||||||
|
$tm->save($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
save a task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$task = new Task();
|
||||||
|
$task->setDescription('foo');
|
||||||
|
$tm->save($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
find a task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$task = $tm->find('b1d46c75-63cc-4753-a20f-a0b376f1ead0');
|
||||||
|
```
|
||||||
|
|
||||||
|
filter tasks:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tasks = $tm->filter('status:pending');
|
||||||
|
$tasks = $tm->filter('status:pending +home');
|
||||||
|
$tasks = $tm->filter('status:pending and +home');
|
||||||
|
$tasks = $tm->filter(['status:pending', '+home']);
|
||||||
|
```
|
||||||
|
|
||||||
|
filter pending tasks:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tasks = $tm->filterPending('+home');
|
||||||
|
$tasks = $tm->filterPending('project:hobby +home');
|
||||||
|
$tasks = $tm->filterPending('project:hobby and +home');
|
||||||
|
$tasks = $tm->filterPending(['project:hobby', '+home']);
|
||||||
|
```
|
||||||
|
|
||||||
|
delete task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm->delete($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
done task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm->done($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
start task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm->start($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
stop task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm->stop($task);
|
||||||
|
```
|
||||||
|
|
||||||
|
reopen task:
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tm->reopen($task);
|
||||||
|
```
|
||||||
|
|
||||||
### QueryBuilder
|
### QueryBuilder
|
||||||
|
|
||||||
|
example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$tasks = $taskManager->createQueryBuilder()
|
$tasks = $taskManager->createQueryBuilder()
|
||||||
->whereProject('hobby')
|
->whereProject('hobby')
|
||||||
|
@ -195,7 +195,7 @@ class QueryBuilder
|
|||||||
*/
|
*/
|
||||||
public function getFilter()
|
public function getFilter()
|
||||||
{
|
{
|
||||||
return implode(' ', $this->filter);
|
return $this->filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,7 +203,7 @@ class QueryBuilder
|
|||||||
*/
|
*/
|
||||||
public function getResult()
|
public function getResult()
|
||||||
{
|
{
|
||||||
$result = $this->taskManager->filter($this->getFilter());
|
$result = $this->taskManager->filter($this->filter);
|
||||||
|
|
||||||
return $result->matching($this->criteria);
|
return $result->matching($this->criteria);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class TaskManager
|
|||||||
return $this->tasks[$uuid];
|
return $this->tasks[$uuid];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tasks = $this->filterAll($uuid);
|
$tasks = $this->filter($uuid);
|
||||||
|
|
||||||
if (count($tasks) == 0) {
|
if (count($tasks) == 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -96,7 +96,7 @@ class TaskManager
|
|||||||
* @param string $filter
|
* @param string $filter
|
||||||
* @return Task[]|ArrayCollection
|
* @return Task[]|ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function filterAll($filter = null)
|
public function filter($filter = null)
|
||||||
{
|
{
|
||||||
$result = $this->export($filter);
|
$result = $this->export($filter);
|
||||||
|
|
||||||
@ -119,9 +119,9 @@ class TaskManager
|
|||||||
* @param string|array $filter
|
* @param string|array $filter
|
||||||
* @return Task[]|ArrayCollection
|
* @return Task[]|ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function filter($filter = null)
|
public function filterPending($filter = null)
|
||||||
{
|
{
|
||||||
return $this->filterAll($filter . ' status:pending');
|
return $this->filter(array_merge((array)$filter, ['status:pending']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,15 +219,6 @@ class TaskManager
|
|||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Task $task
|
|
||||||
*/
|
|
||||||
public function refresh(Task $task)
|
|
||||||
{
|
|
||||||
$clean = $this->export($task->getUuid())[0];
|
|
||||||
$this->merge($task, $clean);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -277,6 +268,15 @@ class TaskManager
|
|||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Task $task
|
||||||
|
*/
|
||||||
|
private function refresh(Task $task)
|
||||||
|
{
|
||||||
|
$clean = $this->export($task->getUuid())[0];
|
||||||
|
$this->merge($task, $clean);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|array $filter
|
* @param string|array $filter
|
||||||
* @return Task[]
|
* @return Task[]
|
||||||
|
@ -47,7 +47,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
*/
|
*/
|
||||||
public function delete($filter)
|
public function delete($filter)
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
*/
|
*/
|
||||||
public function done($filter)
|
public function done($filter)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
*/
|
*/
|
||||||
public function start($filter)
|
public function start($filter)
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
*/
|
*/
|
||||||
public function stop($filter)
|
public function stop($filter)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ class Taskwarrior
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
*/
|
*/
|
||||||
public function modify(array $params, $filter = null)
|
public function modify(array $params, $filter = null)
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function projects($filter = null)
|
public function projects($filter = null)
|
||||||
@ -107,7 +107,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function tags($filter = null)
|
public function tags($filter = null)
|
||||||
@ -146,7 +146,7 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function export($filter = null)
|
public function export($filter = null)
|
||||||
@ -156,7 +156,7 @@ class Taskwarrior
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $command
|
* @param string $command
|
||||||
* @param string $filter
|
* @param string|string[] $filter
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
* @throws TaskwarriorException
|
* @throws TaskwarriorException
|
||||||
@ -170,7 +170,9 @@ class Taskwarrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
$parts[] = "( " . $filter . ' )';
|
foreach((array)$filter as $f) {
|
||||||
|
$parts[] = "( " . $f . ' )';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts[] = $command;
|
$parts[] = $command;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DavidBadura\Taskwarrior\Test;
|
namespace DavidBadura\Taskwarrior\Test\Query;
|
||||||
|
|
||||||
use DavidBadura\Taskwarrior\Query\QueryBuilder;
|
use DavidBadura\Taskwarrior\Query\QueryBuilder;
|
||||||
|
|
||||||
@ -32,6 +32,6 @@ class QueryBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->wherePriority('testPriority')
|
->wherePriority('testPriority')
|
||||||
->getFilter();
|
->getFilter();
|
||||||
|
|
||||||
$this->assertEquals('project:testProject +testTag status:testStatus priority:testPriority', $filter);
|
$this->assertEquals(['project:testProject', '+testTag', 'status:testStatus', 'priority:testPriority'], $filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -50,7 +50,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testEmpty()
|
public function testEmpty()
|
||||||
{
|
{
|
||||||
$tasks = $this->taskManager->filter();
|
$tasks = $this->taskManager->filterPending();
|
||||||
$this->assertEmpty($tasks);
|
$this->assertEmpty($tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->taskManager->save($task);
|
$this->taskManager->save($task);
|
||||||
|
|
||||||
$result = $this->taskManager->filterAll($task->getUuid());
|
$result = $this->taskManager->filter($task->getUuid());
|
||||||
|
|
||||||
$this->assertSame($task, $result[0]);
|
$this->assertSame($task, $result[0]);
|
||||||
}
|
}
|
||||||
@ -147,14 +147,14 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task);
|
$this->taskManager->save($task);
|
||||||
|
|
||||||
$this->assertEquals($uuid, $task->getUuid());
|
$this->assertEquals($uuid, $task->getUuid());
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
|
|
||||||
$this->taskManager->clear();
|
$this->taskManager->clear();
|
||||||
|
|
||||||
$this->taskManager->save($task);
|
$this->taskManager->save($task);
|
||||||
|
|
||||||
$this->assertEquals($uuid, $task->getUuid());
|
$this->assertEquals($uuid, $task->getUuid());
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClone()
|
public function testClone()
|
||||||
@ -163,12 +163,12 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$task->setDescription('foo');
|
$task->setDescription('foo');
|
||||||
|
|
||||||
$this->taskManager->save($task);
|
$this->taskManager->save($task);
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
|
|
||||||
$task2 = clone $task;
|
$task2 = clone $task;
|
||||||
|
|
||||||
$this->taskManager->save($task2);
|
$this->taskManager->save($task2);
|
||||||
$this->assertCount(2, $this->taskManager->filter());
|
$this->assertCount(2, $this->taskManager->filterPending());
|
||||||
|
|
||||||
$this->taskManager->done($task);
|
$this->taskManager->done($task);
|
||||||
$this->isTrue($task->isCompleted());
|
$this->isTrue($task->isCompleted());
|
||||||
@ -194,7 +194,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->taskManager->save($task2);
|
$this->taskManager->save($task2);
|
||||||
|
|
||||||
$result = $this->taskManager->filter();
|
$result = $this->taskManager->filterPending();
|
||||||
|
|
||||||
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $result);
|
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $result);
|
||||||
$this->assertCount(2, $result);
|
$this->assertCount(2, $result);
|
||||||
@ -214,7 +214,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->taskManager->save($task2);
|
$this->taskManager->save($task2);
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filter('project:home prio:H +now'));
|
$this->assertCount(1, $this->taskManager->filterPending('project:home prio:H +now'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testModified()
|
public function testModified()
|
||||||
@ -306,7 +306,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(Task::STATUS_PENDING, $result->getStatus());
|
$this->assertEquals(Task::STATUS_PENDING, $result->getStatus());
|
||||||
$this->assertTrue($result->isPending());
|
$this->assertTrue($result->isPending());
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDelete()
|
public function testDelete()
|
||||||
@ -314,17 +314,17 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$task1 = new Task();
|
$task1 = new Task();
|
||||||
$task1->setDescription('foo1');
|
$task1->setDescription('foo1');
|
||||||
|
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->assertCount(1, $this->taskManager->filterAll());
|
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filter());
|
||||||
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
$this->assertFalse($task1->isDeleted());
|
$this->assertFalse($task1->isDeleted());
|
||||||
$this->assertEquals(Task::STATUS_PENDING, $task1->getStatus());
|
$this->assertEquals(Task::STATUS_PENDING, $task1->getStatus());
|
||||||
|
|
||||||
$this->taskManager->delete($task1);
|
$this->taskManager->delete($task1);
|
||||||
$this->assertCount(1, $this->taskManager->filterAll());
|
$this->assertCount(1, $this->taskManager->filter());
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
$this->assertTrue($task1->isDeleted());
|
$this->assertTrue($task1->isDeleted());
|
||||||
$this->assertEquals(Task::STATUS_DELETED, $task1->getStatus());
|
$this->assertEquals(Task::STATUS_DELETED, $task1->getStatus());
|
||||||
}
|
}
|
||||||
@ -334,17 +334,17 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$task1 = new Task();
|
$task1 = new Task();
|
||||||
$task1->setDescription('foo1');
|
$task1->setDescription('foo1');
|
||||||
|
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->assertCount(1, $this->taskManager->filterAll());
|
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filter());
|
||||||
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
$this->assertFalse($task1->isCompleted());
|
$this->assertFalse($task1->isCompleted());
|
||||||
$this->assertEquals(Task::STATUS_PENDING, $task1->getStatus());
|
$this->assertEquals(Task::STATUS_PENDING, $task1->getStatus());
|
||||||
|
|
||||||
$this->taskManager->done($task1);
|
$this->taskManager->done($task1);
|
||||||
$this->assertCount(1, $this->taskManager->filterAll());
|
$this->assertCount(1, $this->taskManager->filter());
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
$this->assertTrue($task1->isCompleted());
|
$this->assertTrue($task1->isCompleted());
|
||||||
$this->assertEquals(Task::STATUS_COMPLETED, $task1->getStatus());
|
$this->assertEquals(Task::STATUS_COMPLETED, $task1->getStatus());
|
||||||
}
|
}
|
||||||
@ -439,18 +439,18 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('home', $task1->getProject());
|
$this->assertEquals('home', $task1->getProject());
|
||||||
$this->assertEquals('office', $task2->getProject());
|
$this->assertEquals('office', $task2->getProject());
|
||||||
|
|
||||||
$this->assertCount(2, $this->taskManager->filter());
|
$this->assertCount(2, $this->taskManager->filterPending());
|
||||||
$this->assertCount(1, $this->taskManager->filter('project:home'));
|
$this->assertCount(1, $this->taskManager->filterPending('project:home'));
|
||||||
$this->assertCount(1, $this->taskManager->filter('project:office'));
|
$this->assertCount(1, $this->taskManager->filterPending('project:office'));
|
||||||
$this->assertCount(0, $this->taskManager->filter('project:hobby'));
|
$this->assertCount(0, $this->taskManager->filterPending('project:hobby'));
|
||||||
|
|
||||||
$task2->setProject('home');
|
$task2->setProject('home');
|
||||||
$this->taskManager->save($task2);
|
$this->taskManager->save($task2);
|
||||||
|
|
||||||
$this->assertCount(2, $this->taskManager->filter());
|
$this->assertCount(2, $this->taskManager->filterPending());
|
||||||
$this->assertCount(2, $this->taskManager->filter('project:home'));
|
$this->assertCount(2, $this->taskManager->filterPending('project:home'));
|
||||||
$this->assertCount(0, $this->taskManager->filter('project:office'));
|
$this->assertCount(0, $this->taskManager->filterPending('project:office'));
|
||||||
$this->assertCount(0, $this->taskManager->filter('project:hobby'));
|
$this->assertCount(0, $this->taskManager->filterPending('project:hobby'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProjects()
|
public function testProjects()
|
||||||
@ -521,8 +521,8 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$task1 = $this->taskManager->find($task1->getUuid());
|
$task1 = $this->taskManager->find($task1->getUuid());
|
||||||
$this->assertEquals(array('b', 'c', 'd'), $task1->getTags());
|
$this->assertEquals(array('b', 'c', 'd'), $task1->getTags());
|
||||||
$this->assertCount(0, $this->taskManager->filter('+a'));
|
$this->assertCount(0, $this->taskManager->filterPending('+a'));
|
||||||
$this->assertCount(1, $this->taskManager->filter('+b'));
|
$this->assertCount(1, $this->taskManager->filterPending('+b'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTagUnicode()
|
public function testTagUnicode()
|
||||||
@ -538,7 +538,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(array('später'), $task1->getTags());
|
$this->assertEquals(array('später'), $task1->getTags());
|
||||||
$this->assertEquals(array('später'), $this->taskwarrior->tags());
|
$this->assertEquals(array('später'), $this->taskwarrior->tags());
|
||||||
|
|
||||||
$this->assertCount(1,$this->taskManager->filter('+später'));
|
$this->assertCount(1,$this->taskManager->filterPending('+später'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWait()
|
public function testWait()
|
||||||
@ -556,12 +556,12 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->assertTrue($task1->isWaiting());
|
$this->assertTrue($task1->isWaiting());
|
||||||
|
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
$this->assertCount(1, $this->taskManager->filterAll('status:waiting'));
|
$this->assertCount(1, $this->taskManager->filter('status:waiting'));
|
||||||
|
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
$this->assertFalse($task1->isWaiting());
|
$this->assertFalse($task1->isWaiting());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,11 +574,11 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
|
|
||||||
$this->assertCount(2, $this->taskManager->filterAll());
|
$this->assertCount(2, $this->taskManager->filter());
|
||||||
|
|
||||||
$this->assertTrue($task1->isRecurring());
|
$this->assertTrue($task1->isRecurring());
|
||||||
|
|
||||||
$result = $this->taskManager->filter();
|
$result = $this->taskManager->filterPending();
|
||||||
$this->assertCount(1, $result);
|
$this->assertCount(1, $result);
|
||||||
|
|
||||||
$this->assertTrue($result[0]->isPending());
|
$this->assertTrue($result[0]->isPending());
|
||||||
@ -640,7 +640,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filterAll());
|
$this->assertCount(1, $this->taskManager->filter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRecurringModify()
|
public function testRecurringModify()
|
||||||
@ -680,15 +680,15 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->taskManager->clear();
|
$this->taskManager->clear();
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filterAll('status:recurring'));
|
$this->assertCount(1, $this->taskManager->filter('status:recurring'));
|
||||||
$this->assertCount(2, $this->taskManager->filterAll());
|
$this->assertCount(2, $this->taskManager->filter());
|
||||||
|
|
||||||
$this->taskManager->delete($task1);
|
$this->taskManager->delete($task1);
|
||||||
|
|
||||||
$this->taskManager->clear();
|
$this->taskManager->clear();
|
||||||
|
|
||||||
$this->assertCount(0, $this->taskManager->filterAll('status:recurring'));
|
$this->assertCount(0, $this->taskManager->filter('status:recurring'));
|
||||||
$this->assertCount(2, $this->taskManager->filterAll());
|
$this->assertCount(2, $this->taskManager->filter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUntil()
|
public function testUntil()
|
||||||
@ -699,11 +699,11 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
|
|
||||||
$this->assertCount(1, $this->taskManager->filter());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
|
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
$this->assertCount(0, $this->taskManager->filter());
|
$this->assertCount(0, $this->taskManager->filterPending());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -763,7 +763,8 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$task1->setDescription('foo1');
|
$task1->setDescription('foo1');
|
||||||
|
|
||||||
$this->taskManager->save($task1);
|
$this->taskManager->save($task1);
|
||||||
$this->assertCount(1, $this->taskManager->filterAll('(status:pending or status:waiting)'));
|
$this->assertCount(1, $this->taskManager->filter('(status:pending or status:waiting)'));
|
||||||
|
$this->assertCount(1, $this->taskManager->filterPending('(status:pending or status:waiting)'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user