public function testDuplicateSameProject()
 {
     $td = new TaskDuplication($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $c = new Category($this->container);
     // We create a task and a project
     $this->assertEquals(1, $p->create(array('name' => 'test1')));
     // Some categories
     $this->assertNotFalse($c->create(array('name' => 'Category #1', 'project_id' => 1)));
     $this->assertNotFalse($c->create(array('name' => 'Category #2', 'project_id' => 1)));
     $this->assertTrue($c->exists(1, 1));
     $this->assertTrue($c->exists(2, 1));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1, 'category_id' => 2, 'time_spent' => 4.4)));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(1, $task['position']);
     $this->assertEquals(1, $task['project_id']);
     $this->assertEquals(3, $task['column_id']);
     $this->assertEquals(2, $task['category_id']);
     $this->assertEquals(4.4, $task['time_spent']);
     $this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function () {
     });
     $this->container['dispatcher']->addListener(Task::EVENT_CREATE, function () {
     });
     // We duplicate our task
     $this->assertEquals(2, $td->duplicate(1));
     $called = $this->container['dispatcher']->getCalledListeners();
     $this->assertArrayHasKey(Task::EVENT_CREATE_UPDATE . '.closure', $called);
     $this->assertArrayHasKey(Task::EVENT_CREATE . '.closure', $called);
     // Check the values of the duplicated task
     $task = $tf->getById(2);
     $this->assertNotEmpty($task);
     $this->assertEquals(Task::STATUS_OPEN, $task['is_active']);
     $this->assertEquals(1, $task['project_id']);
     $this->assertEquals(1, $task['owner_id']);
     $this->assertEquals(2, $task['category_id']);
     $this->assertEquals(0, $task['swimlane_id']);
     $this->assertEquals(3, $task['column_id']);
     $this->assertEquals(2, $task['position']);
     $this->assertEquals('test', $task['title']);
     $this->assertEquals(0, $task['time_spent']);
 }