Esempio n. 1
0
 public function testDisable()
 {
     $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')));
     $swimlane = $s->getById(1);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(1, $swimlane['position']);
     $this->assertEquals(2, $s->getLastPosition(1));
     $this->assertTrue($s->disable(1, 1));
     $swimlane = $s->getById(1);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(0, $swimlane['is_active']);
     $this->assertEquals(0, $swimlane['position']);
     $this->assertEquals(1, $s->getLastPosition(1));
     // Create a new swimlane
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
     $swimlane = $s->getById(2);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(1, $swimlane['position']);
     // Enable our disabled swimlane
     $this->assertTrue($s->enable(1, 1));
     $swimlane = $s->getById(1);
     $this->assertNotEmpty($swimlane);
     $this->assertEquals(1, $swimlane['is_active']);
     $this->assertEquals(2, $swimlane['position']);
 }