public function testCloseBySwimlaneAndColumn()
 {
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $ts = new TaskStatus($this->container);
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $s->create(array('name' => 'test', 'project_id' => 1)));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'test', 'project_id' => 1)));
     $this->assertEquals(3, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2)));
     $this->assertEquals(4, $tc->create(array('title' => 'test', 'project_id' => 1, 'swimlane_id' => 1)));
     $this->assertEquals(2, $tf->countByColumnAndSwimlaneId(1, 1, 0));
     $this->assertEquals(1, $tf->countByColumnAndSwimlaneId(1, 1, 1));
     $this->assertEquals(1, $tf->countByColumnAndSwimlaneId(1, 2, 0));
     $ts->closeTasksBySwimlaneAndColumn(0, 1);
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 1, 0));
     $this->assertEquals(1, $tf->countByColumnAndSwimlaneId(1, 1, 1));
     $this->assertEquals(1, $tf->countByColumnAndSwimlaneId(1, 2, 0));
     $ts->closeTasksBySwimlaneAndColumn(1, 1);
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 1, 0));
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 1, 1));
     $this->assertEquals(1, $tf->countByColumnAndSwimlaneId(1, 2, 0));
     $ts->closeTasksBySwimlaneAndColumn(0, 2);
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 1, 0));
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 1, 1));
     $this->assertEquals(0, $tf->countByColumnAndSwimlaneId(1, 2, 0));
 }
 public function testMoveTaskAnotherSwimlane()
 {
     $tp = new TaskPosition($this->container);
     $tc = new TaskCreation($this->container);
     $p = new Project($this->container);
     $tf = new TaskFinder($this->container);
     $s = new Swimlane($this->container);
     $this->container['dispatcher'] = new EventDispatcher();
     $this->container['dispatcher']->addSubscriber(new TaskMovedDateSubscriber($this->container));
     $now = time();
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1)));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals($now, $task['date_moved'], '', 1);
     $this->assertEquals(1, $task['column_id']);
     $this->assertEquals(0, $task['swimlane_id']);
     sleep(1);
     $this->assertTrue($tp->movePosition(1, 1, 2, 1, 2));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertNotEquals($now, $task['date_moved']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(2, $task['swimlane_id']);
 }
Exemplo n.º 3
0
 public function testExport()
 {
     $tc = new TaskCreation($this->container);
     $p = new Project($this->container);
     $c = new Category($this->container);
     $e = new TaskExport($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Export Project')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertNotFalse($c->create(array('name' => 'Category #1', 'project_id' => 1)));
     $this->assertNotFalse($c->create(array('name' => 'Category #2', 'project_id' => 1)));
     $this->assertNotFalse($c->create(array('name' => 'Category #3', 'project_id' => 1)));
     for ($i = 1; $i <= 100; $i++) {
         $task = array('title' => 'Task #' . $i, 'project_id' => 1, 'column_id' => rand(1, 3), 'creator_id' => rand(0, 1), 'owner_id' => rand(0, 1), 'color_id' => rand(0, 1) === 0 ? 'green' : 'purple', 'category_id' => rand(0, 3), 'date_due' => array_rand(array(0, date('Y-m-d'), date('Y-m-d', strtotime('+' . $i . 'day')))), 'score' => rand(0, 21), 'swimlane_id' => rand(0, 2));
         $this->assertEquals($i, $tc->create($task));
     }
     $rows = $e->export(1, strtotime('-1 day'), strtotime('+1 day'));
     $this->assertEquals($i, count($rows));
     $this->assertEquals('Task Id', $rows[0][0]);
     $this->assertEquals(1, $rows[1][0]);
     $this->assertEquals('Task #' . ($i - 1), $rows[$i - 1][12]);
     $this->assertTrue(in_array($rows[$i - 1][4], array('Default swimlane', 'S1', 'S2')));
 }
Exemplo n.º 4
0
 public function testChangePositionWithInactiveSwimlane()
 {
     $projectModel = new Project($this->container);
     $swimlaneModel = new Swimlane($this->container);
     $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
     $this->assertEquals(1, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
     $this->assertEquals(2, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #2', 'is_active' => 0)));
     $this->assertEquals(3, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #3', 'is_active' => 0)));
     $this->assertEquals(4, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #4')));
     $swimlanes = $swimlaneModel->getAllByStatus(1);
     $this->assertEquals(1, $swimlanes[0]['position']);
     $this->assertEquals(1, $swimlanes[0]['id']);
     $this->assertEquals(2, $swimlanes[1]['position']);
     $this->assertEquals(4, $swimlanes[1]['id']);
     $this->assertTrue($swimlaneModel->changePosition(1, 4, 1));
     $swimlanes = $swimlaneModel->getAllByStatus(1);
     $this->assertEquals(1, $swimlanes[0]['position']);
     $this->assertEquals(4, $swimlanes[0]['id']);
     $this->assertEquals(2, $swimlanes[1]['position']);
     $this->assertEquals(1, $swimlanes[1]['id']);
 }
Exemplo n.º 5
0
 public function testDuplicateSwimlane()
 {
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'P1')));
     $this->assertEquals(2, $p->create(array('name' => 'P2')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'S3')));
     $default_swimlane1 = $s->getDefault(1);
     $default_swimlane1['default_swimlane'] = 'New Default';
     $this->assertTrue($s->updateDefault($default_swimlane1));
     $this->assertTrue($s->duplicate(1, 2));
     $swimlanes = $s->getAll(2);
     $this->assertCount(3, $swimlanes);
     $this->assertEquals(4, $swimlanes[0]['id']);
     $this->assertEquals('S1', $swimlanes[0]['name']);
     $this->assertEquals(5, $swimlanes[1]['id']);
     $this->assertEquals('S2', $swimlanes[1]['name']);
     $this->assertEquals(6, $swimlanes[2]['id']);
     $this->assertEquals('S3', $swimlanes[2]['name']);
     $new_default = $s->getDefault(2);
     $this->assertEquals('New Default', $new_default['default_swimlane']);
 }
Exemplo n.º 6
0
 public function testMoveAnotherProjectWithoutSwimlane()
 {
     $td = new TaskDuplication($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     // We create 2 projects
     $this->assertEquals(1, $p->create(array('name' => 'test1')));
     $this->assertEquals(2, $p->create(array('name' => 'test2')));
     $this->assertNotFalse($s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
     $this->assertNotFalse($s->create(array('project_id' => 2, 'name' => 'Swimlane #2')));
     // We create a task
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'swimlane_id' => 1)));
     // We move our task to the 2nd project
     $this->assertTrue($td->moveToProject(1, 2));
     // Check the values of the moved task
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(0, $task['owner_id']);
     $this->assertEquals(0, $task['category_id']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(6, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('test', $task['title']);
 }
Exemplo n.º 7
0
 public function testSearchWithSwimlane()
 {
     $p = new Project($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFilter($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'My project A')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Version 1.1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Version 1.2')));
     $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1', 'swimlane_id' => 1)));
     $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task2', 'swimlane_id' => 2)));
     $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task3', 'swimlane_id' => 0)));
     $tf->search('swimlane:"Version 1.1"');
     $tasks = $tf->findAll();
     $this->assertNotEmpty($tasks);
     $this->assertCount(1, $tasks);
     $this->assertEquals('task1', $tasks[0]['title']);
     $this->assertEquals('Version 1.1', $tasks[0]['swimlane_name']);
     $tf->search('swimlane:"versioN 1.2"');
     $tasks = $tf->findAll();
     $this->assertNotEmpty($tasks);
     $this->assertCount(1, $tasks);
     $this->assertEquals('task2', $tasks[0]['title']);
     $this->assertEquals('Version 1.2', $tasks[0]['swimlane_name']);
     $tf->search('swimlane:"Default swimlane"');
     $tasks = $tf->findAll();
     $this->assertNotEmpty($tasks);
     $this->assertCount(1, $tasks);
     $this->assertEquals('task3', $tasks[0]['title']);
     $this->assertEquals('Default swimlane', $tasks[0]['default_swimlane']);
     $this->assertEquals('', $tasks[0]['swimlane_name']);
     $tf->search('swimlane:default');
     $tasks = $tf->findAll();
     $this->assertNotEmpty($tasks);
     $this->assertCount(1, $tasks);
     $this->assertEquals('task3', $tasks[0]['title']);
     $this->assertEquals('Default swimlane', $tasks[0]['default_swimlane']);
     $this->assertEquals('', $tasks[0]['swimlane_name']);
     $tf->search('swimlane:"Version 1.1" swimlane:"Version 1.2"');
     $tasks = $tf->findAll();
     $this->assertNotEmpty($tasks);
     $this->assertCount(2, $tasks);
     $this->assertEquals('task1', $tasks[0]['title']);
     $this->assertEquals('Version 1.1', $tasks[0]['swimlane_name']);
     $this->assertEquals('task2', $tasks[1]['title']);
     $this->assertEquals('Version 1.2', $tasks[1]['swimlane_name']);
     $tf->search('swimlane:"not found"');
     $tasks = $tf->findAll();
     $this->assertEmpty($tasks);
 }
Exemplo n.º 8
0
 public function testCloneProjectWithTasks()
 {
     $p = new Project($this->container);
     $pd = new ProjectDuplication($this->container);
     $s = new Swimlane($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'P1')));
     // create initial swimlanes
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'S3')));
     $default_swimlane1 = $s->getDefault(1);
     $default_swimlane1['default_swimlane'] = 'New Default';
     $this->assertTrue($s->updateDefault($default_swimlane1));
     //create initial tasks
     $this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1)));
     $this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
     $this->assertNotFalse($pd->duplicate(1, array('category', 'action', 'task')));
     $project = $p->getByName('P1 (Clone)');
     $this->assertNotFalse($project);
     $project_id = $project['id'];
     // Check if Swimlanes have NOT been duplicated
     $this->assertCount(0, $s->getAll($project_id));
     // Check if Tasks have been duplicated
     $tasks = $tf->getAll($project_id);
     $this->assertCount(3, $tasks);
     //$this->assertEquals(4, $tasks[0]['id']);
     $this->assertEquals('T1', $tasks[0]['title']);
     //$this->assertEquals(5, $tasks[1]['id']);
     $this->assertEquals('T2', $tasks[1]['title']);
     //$this->assertEquals(6, $tasks[2]['id']);
     $this->assertEquals('T3', $tasks[2]['title']);
 }
Exemplo n.º 9
0
 public function testEvents()
 {
     $tp = new TaskPosition($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'test 1')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'column_id' => 2)));
     $this->container['dispatcher']->addListener(Task::EVENT_MOVE_COLUMN, array($this, 'onMoveColumn'));
     $this->container['dispatcher']->addListener(Task::EVENT_MOVE_POSITION, array($this, 'onMovePosition'));
     $this->container['dispatcher']->addListener(Task::EVENT_MOVE_SWIMLANE, array($this, 'onMoveSwimlane'));
     // We move the task 1 to the column 2
     $this->assertTrue($tp->movePosition(1, 1, 2, 1));
     $task = $tf->getById(1);
     $this->assertEquals(1, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $task = $tf->getById(2);
     $this->assertEquals(2, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(2, $task['position']);
     $called = $this->container['dispatcher']->getCalledListeners();
     $this->assertArrayHasKey(Task::EVENT_MOVE_COLUMN . '.TaskPositionTest::onMoveColumn', $called);
     $this->assertEquals(1, count($called));
     // We move the task 1 to the position 2
     $this->assertTrue($tp->movePosition(1, 1, 2, 2));
     $task = $tf->getById(1);
     $this->assertEquals(1, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(2, $task['position']);
     $task = $tf->getById(2);
     $this->assertEquals(2, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $called = $this->container['dispatcher']->getCalledListeners();
     $this->assertArrayHasKey(Task::EVENT_MOVE_POSITION . '.TaskPositionTest::onMovePosition', $called);
     $this->assertEquals(2, count($called));
     // Move to another swimlane
     $this->assertTrue($tp->movePosition(1, 1, 3, 1, 1));
     $task = $tf->getById(1);
     $this->assertEquals(1, $task['id']);
     $this->assertEquals(3, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(1, $task['swimlane_id']);
     $task = $tf->getById(2);
     $this->assertEquals(2, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(0, $task['swimlane_id']);
     $called = $this->container['dispatcher']->getCalledListeners();
     $this->assertArrayHasKey(Task::EVENT_MOVE_SWIMLANE . '.TaskPositionTest::onMoveSwimlane', $called);
     $this->assertEquals(3, count($called));
 }
Exemplo n.º 10
0
 public function testGetBoardWithSwimlane()
 {
     $b = new Board($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'test 1')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'column_id' => 3)));
     $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'column_id' => 2, 'swimlane_id' => 1)));
     $this->assertEquals(4, $tc->create(array('title' => 'Task #4', 'project_id' => 1, 'column_id' => 3)));
     $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1, 'column_id' => 4, 'score' => 2)));
     $this->assertEquals(6, $tc->create(array('title' => 'Task #6', 'project_id' => 1, 'column_id' => 4, 'score' => 3, 'swimlane_id' => 1)));
     $board = $b->getBoard(1);
     $this->assertNotEmpty($board);
     $this->assertEquals(2, count($board));
     $this->assertEquals(6, count($board[0]));
     $this->assertArrayHasKey('name', $board[0]);
     $this->assertArrayHasKey('nb_tasks', $board[0]);
     $this->assertArrayHasKey('columns', $board[0]);
     $this->assertArrayHasKey('tasks', $board[0]['columns'][2]);
     $this->assertArrayHasKey('nb_tasks', $board[0]['columns'][2]);
     $this->assertArrayHasKey('title', $board[0]['columns'][2]);
     $this->assertArrayHasKey('nb_column_tasks', $board[0]['columns'][0]);
     $this->assertArrayNotHasKey('nb_column_tasks', $board[1]['columns'][0]);
     $this->assertArrayNotHasKey('total_score', $board[1]['columns'][0]);
     $this->assertArrayHasKey('score', $board[0]['columns'][3]);
     $this->assertArrayHasKey('total_score', $board[0]['columns'][3]);
     $this->assertEquals(2, $board[0]['columns'][3]['score']);
     $this->assertEquals(5, $board[0]['columns'][3]['total_score']);
     $task = $tf->getById(1);
     $this->assertEquals(1, $task['id']);
     $this->assertEquals(1, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(1, $board[0]['columns'][0]['tasks'][0]['id']);
     $this->assertEquals(1, $board[0]['columns'][0]['tasks'][0]['column_id']);
     $this->assertEquals(1, $board[0]['columns'][0]['tasks'][0]['position']);
     $this->assertEquals(0, $board[0]['columns'][0]['tasks'][0]['swimlane_id']);
     $task = $tf->getById(2);
     $this->assertEquals(2, $task['id']);
     $this->assertEquals(3, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(2, $board[0]['columns'][2]['tasks'][0]['id']);
     $this->assertEquals(3, $board[0]['columns'][2]['tasks'][0]['column_id']);
     $this->assertEquals(1, $board[0]['columns'][2]['tasks'][0]['position']);
     $this->assertEquals(0, $board[0]['columns'][2]['tasks'][0]['swimlane_id']);
     $task = $tf->getById(3);
     $this->assertEquals(3, $task['id']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(1, $task['swimlane_id']);
     $this->assertEquals(3, $board[1]['columns'][1]['tasks'][0]['id']);
     $this->assertEquals(2, $board[1]['columns'][1]['tasks'][0]['column_id']);
     $this->assertEquals(1, $board[1]['columns'][1]['tasks'][0]['position']);
     $this->assertEquals(1, $board[1]['columns'][1]['tasks'][0]['swimlane_id']);
     $task = $tf->getById(4);
     $this->assertEquals(4, $task['id']);
     $this->assertEquals(3, $task['column_id']);
     $this->assertEquals(2, $task['position']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(4, $board[0]['columns'][2]['tasks'][1]['id']);
     $this->assertEquals(3, $board[0]['columns'][2]['tasks'][1]['column_id']);
     $this->assertEquals(2, $board[0]['columns'][2]['tasks'][1]['position']);
     $this->assertEquals(0, $board[0]['columns'][2]['tasks'][1]['swimlane_id']);
     $task = $tf->getById(5);
     $this->assertEquals(5, $task['id']);
     $this->assertEquals(4, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(5, $board[0]['columns'][3]['tasks'][0]['id']);
     $this->assertEquals(4, $board[0]['columns'][3]['tasks'][0]['column_id']);
     $this->assertEquals(1, $board[0]['columns'][3]['tasks'][0]['position']);
     $this->assertEquals(0, $board[0]['columns'][3]['tasks'][0]['swimlane_id']);
     $task = $tf->getById(6);
     $this->assertEquals(6, $task['id']);
     $this->assertEquals(4, $task['column_id']);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(1, $task['swimlane_id']);
     $this->assertEquals(6, $board[1]['columns'][3]['tasks'][0]['id']);
     $this->assertEquals(4, $board[1]['columns'][3]['tasks'][0]['column_id']);
     $this->assertEquals(1, $board[1]['columns'][3]['tasks'][0]['position']);
     $this->assertEquals(1, $board[1]['columns'][3]['tasks'][0]['swimlane_id']);
 }
Exemplo n.º 11
0
 public function testCloneProjectWithSwimlanesAndTasks()
 {
     $p = new Project($this->container);
     $pd = new ProjectDuplication($this->container);
     $s = new Swimlane($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'P1', 'default_swimlane' => 'New Default')));
     // create initial swimlanes
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'S3')));
     // create initial tasks
     $this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1)));
     $this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
     $this->assertEquals(2, $pd->duplicate(1, array('projectPermission', 'swimlane', 'task')));
     // Check if Swimlanes have been duplicated
     $swimlanes = $s->getAll(2);
     $this->assertCount(3, $swimlanes);
     $this->assertEquals(4, $swimlanes[0]['id']);
     $this->assertEquals('S1', $swimlanes[0]['name']);
     $this->assertEquals(5, $swimlanes[1]['id']);
     $this->assertEquals('S2', $swimlanes[1]['name']);
     $this->assertEquals(6, $swimlanes[2]['id']);
     $this->assertEquals('S3', $swimlanes[2]['name']);
     $swimlane = $s->getDefault(2);
     $this->assertEquals('New Default', $swimlane['default_swimlane']);
     // Check if Tasks have been duplicated
     $tasks = $tf->getAll(2);
     $this->assertCount(3, $tasks);
     $this->assertEquals('T1', $tasks[0]['title']);
     $this->assertEquals('T2', $tasks[1]['title']);
     $this->assertEquals('T3', $tasks[2]['title']);
 }