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