cleanup tests
This commit is contained in:
parent
14fdb68203
commit
e04ae2b2a7
@ -435,39 +435,38 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(0, $task1->getUrgency());
|
$this->assertEquals(0, $task1->getUrgency());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProject()
|
|
||||||
|
public function provideProjectNames()
|
||||||
{
|
{
|
||||||
$task1 = new Task();
|
return [
|
||||||
$task1->setDescription('foo1');
|
['foo'],
|
||||||
$task1->setProject('home');
|
['später'],
|
||||||
|
['grandparent.parent.child'],
|
||||||
|
['parent.child'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$task2 = new Task();
|
/**
|
||||||
$task2->setDescription('foo2');
|
* @dataProvider provideProjectNames
|
||||||
$task2->setProject('office');
|
*/
|
||||||
|
public function testProject($project)
|
||||||
|
{
|
||||||
|
$task = new Task();
|
||||||
|
$task->setDescription('foo1');
|
||||||
|
$task->setProject($project);
|
||||||
|
|
||||||
$this->taskManager->save($task1);
|
// no exception thrown
|
||||||
$this->taskManager->save($task2);
|
$this->taskManager->save($task);
|
||||||
|
|
||||||
|
// refetch the task
|
||||||
$this->taskManager->clear();
|
$this->taskManager->clear();
|
||||||
|
$task = $this->taskManager->find($task->getUuid());
|
||||||
|
|
||||||
$task1 = $this->taskManager->find($task1->getUuid());
|
$this->assertEquals($project, $task->getProject());
|
||||||
$task2 = $this->taskManager->find($task2->getUuid());
|
|
||||||
|
|
||||||
$this->assertEquals('home', $task1->getProject());
|
$this->assertCount(1, $this->taskManager->filterPending());
|
||||||
$this->assertEquals('office', $task2->getProject());
|
$this->assertCount(1, $this->taskManager->filterPending('project:' . $project));
|
||||||
|
$this->assertCount(0, $this->taskManager->filterPending('project:emtpy_project'));
|
||||||
$this->assertCount(2, $this->taskManager->filterPending());
|
|
||||||
$this->assertCount(1, $this->taskManager->filterPending('project:home'));
|
|
||||||
$this->assertCount(1, $this->taskManager->filterPending('project:office'));
|
|
||||||
$this->assertCount(0, $this->taskManager->filterPending('project:hobby'));
|
|
||||||
|
|
||||||
$task2->setProject('home');
|
|
||||||
$this->taskManager->save($task2);
|
|
||||||
|
|
||||||
$this->assertCount(2, $this->taskManager->filterPending());
|
|
||||||
$this->assertCount(2, $this->taskManager->filterPending('project:home'));
|
|
||||||
$this->assertCount(0, $this->taskManager->filterPending('project:office'));
|
|
||||||
$this->assertCount(0, $this->taskManager->filterPending('project:hobby'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProjects()
|
public function testProjects()
|
||||||
@ -570,33 +569,6 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->taskManager->save($task1);
|
$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()
|
public function testWait()
|
||||||
{
|
{
|
||||||
$task1 = new Task();
|
$task1 = new Task();
|
||||||
|
Loading…
Reference in New Issue
Block a user