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