public function testMoveUp() { $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']); // Move the swimlane 3 up $this->assertTrue($s->moveUp(1, 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(3, $swimlane['position']); $swimlane = $s->getById(3); $this->assertNotEmpty($swimlane); $this->assertEquals(1, $swimlane['is_active']); $this->assertEquals(2, $swimlane['position']); // First swimlane can be moved up $this->assertFalse($s->moveUp(1, 1)); // Move with a disabled swimlane $this->assertTrue($s->disable(1, 1)); $swimlane = $s->getById(1); $this->assertNotEmpty($swimlane); $this->assertEquals(0, $swimlane['is_active']); $this->assertEquals(0, $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(1, $swimlane['position']); // Move the 2nd swimlane up $this->assertTrue($s->moveUp(1, 2)); $swimlane = $s->getById(1); $this->assertNotEmpty($swimlane); $this->assertEquals(0, $swimlane['is_active']); $this->assertEquals(0, $swimlane['position']); $swimlane = $s->getById(2); $this->assertNotEmpty($swimlane); $this->assertEquals(1, $swimlane['is_active']); $this->assertEquals(1, $swimlane['position']); $swimlane = $s->getById(3); $this->assertNotEmpty($swimlane); $this->assertEquals(1, $swimlane['is_active']); $this->assertEquals(2, $swimlane['position']); }