Ejemplo n.º 1
0
 public function testExists()
 {
     $projectModel = new Project($this->container);
     $categoryModel = new Category($this->container);
     $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $categoryModel->create(array('name' => 'Category #1', 'project_id' => 1)));
     $this->assertTrue($categoryModel->exists(1));
     $this->assertFalse($categoryModel->exists(2));
 }
Ejemplo n.º 2
0
 public function testMoveAnotherProjectWithCategory()
 {
     $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 2 projects
     $this->assertEquals(1, $p->create(array('name' => 'test1')));
     $this->assertEquals(2, $p->create(array('name' => 'test2')));
     $this->assertNotFalse($c->create(array('name' => 'Category #1', 'project_id' => 1)));
     $this->assertNotFalse($c->create(array('name' => 'Category #1', 'project_id' => 2)));
     $this->assertTrue($c->exists(1, 1));
     $this->assertTrue($c->exists(2, 2));
     // We create a task
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'category_id' => 1)));
     // We move our task to the 2nd project
     $this->assertTrue($td->moveToProject(1, 2));
     // Check the values of the duplicated task
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(0, $task['owner_id']);
     $this->assertEquals(2, $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']);
 }