コード例 #1
0
ファイル: SwimlaneTest.php プロジェクト: jclafuente/kanboard
 public function testUpdatePositions()
 {
     $p = new Project($this->container);
     $s = new Swimlane($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'UnitTest')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
     $this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'Swimlane #3')));
     $swimlane = $s->getById(1);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(1, $swimlane['position']);
     $swimlane = $s->getById(2);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(2, $swimlane['position']);
     $swimlane = $s->getById(3);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(3, $swimlane['position']);
     // Disable the 2nd swimlane
     $this->assertTrue($s->disable(1, 2));
     $swimlane = $s->getById(1);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(1, $swimlane['position']);
     $swimlane = $s->getById(2);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(0, $swimlane['is_active']);
     $this->assertEquals(0, $swimlane['position']);
     $swimlane = $s->getById(3);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(2, $swimlane['position']);
     // Remove the first swimlane
     $this->assertTrue($s->remove(1, 1));
     $swimlane = $s->getById(1);
     $this->assertEmpty($swimlane);
     $swimlane = $s->getById(2);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(0, $swimlane['is_active']);
     $this->assertEquals(0, $swimlane['position']);
     $swimlane = $s->getById(3);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(1, $swimlane['position']);
 }