Ejemplo n.º 1
0
 public function testCreation()
 {
     $p = new Project($this->container);
     $b = new Board($this->container);
     $columnModel = new Column($this->container);
     $c = new Config($this->container);
     // Default columns
     $this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
     $columns = $columnModel->getList(1);
     $this->assertTrue(is_array($columns));
     $this->assertEquals(4, count($columns));
     $this->assertEquals('Backlog', $columns[1]);
     $this->assertEquals('Ready', $columns[2]);
     $this->assertEquals('Work in progress', $columns[3]);
     $this->assertEquals('Done', $columns[4]);
     // Custom columns: spaces should be trimed and no empty columns
     $input = '   column #1  , column #2, ';
     $this->assertTrue($c->save(array('board_columns' => $input)));
     $this->container['memoryCache']->flush();
     $this->assertEquals($input, $c->get('board_columns'));
     $this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
     $columns = $columnModel->getList(2);
     $this->assertTrue(is_array($columns));
     $this->assertEquals(2, count($columns));
     $this->assertEquals('column #1', $columns[5]);
     $this->assertEquals('column #2', $columns[6]);
 }
Ejemplo n.º 2
0
 public function testGetList()
 {
     $projectModel = new Project($this->container);
     $columnModel = new Column($this->container);
     $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest')));
     $columns = $columnModel->getList(1);
     $this->assertCount(4, $columns);
     $this->assertEquals('Backlog', $columns[1]);
     $this->assertEquals('Ready', $columns[2]);
     $this->assertEquals('Work in progress', $columns[3]);
     $this->assertEquals('Done', $columns[4]);
     $columns = $columnModel->getList(1, true);
     $this->assertCount(5, $columns);
     $this->assertEquals('All columns', $columns[-1]);
     $this->assertEquals('Backlog', $columns[1]);
     $this->assertEquals('Ready', $columns[2]);
     $this->assertEquals('Work in progress', $columns[3]);
     $this->assertEquals('Done', $columns[4]);
 }
Ejemplo n.º 3
0
 public function testGetTaskProgression()
 {
     $t = new Task($this->container);
     $ts = new TaskStatus($this->container);
     $tp = new TaskPosition($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $columnModel = new Column($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1)));
     $this->assertEquals(0, $t->getProgress($tf->getById(1), $columnModel->getList(1)));
     $this->assertTrue($tp->movePosition(1, 1, 2, 1));
     $this->assertEquals(25, $t->getProgress($tf->getById(1), $columnModel->getList(1)));
     $this->assertTrue($tp->movePosition(1, 1, 3, 1));
     $this->assertEquals(50, $t->getProgress($tf->getById(1), $columnModel->getList(1)));
     $this->assertTrue($tp->movePosition(1, 1, 4, 1));
     $this->assertEquals(75, $t->getProgress($tf->getById(1), $columnModel->getList(1)));
     $this->assertTrue($ts->close(1));
     $this->assertEquals(100, $t->getProgress($tf->getById(1), $columnModel->getList(1)));
 }