clear taskamanager and refetch data before asserting data was saved, extract test data into dataProvider

This commit is contained in:
Tobias Olry 2015-07-29 07:54:35 +02:00
parent d18a3acca8
commit 57441c8ed4
1 changed files with 22 additions and 10 deletions

View File

@ -564,19 +564,31 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$this->taskManager->save($task1);
}
public function testProjectHierarchyAllowed()
public function provideProjectNames()
{
$projects = ['grandparent.parent.child', 'parent.child'];
foreach ($projects as $project) {
$task = new Task();
$task->setDescription('foo1');
$task->setProject($project);
return [
['grandparent.parent.child'],
['parent.child'],
];
}
// now exception thrown
$this->taskManager->save($task);
/**
* @dataProvider provideProjectNames
*/
public function testProjectHierarchyAllowed($project)
{
$task = new Task();
$task->setDescription('foo1');
$task->setProject($project);
$this->assertEquals($project, $task->getProject());
}
// 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()