Add drag and drop to change swimlane positions

This commit is contained in:
Frederic Guillot
2016-02-20 18:11:08 -05:00
parent da7259819b
commit 5fe68d4d49
41 changed files with 588 additions and 645 deletions

View File

@@ -170,122 +170,6 @@ class Api extends PHPUnit_Framework_TestCase
$this->assertCount(0, $activities);
}
public function testGetDefaultSwimlane()
{
$swimlane = $this->client->getDefaultSwimlane(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals('Default swimlane', $swimlane['default_swimlane']);
}
public function testAddSwimlane()
{
$swimlane_id = $this->client->addSwimlane(1, 'Swimlane 1');
$this->assertNotFalse($swimlane_id);
$this->assertInternalType('int', $swimlane_id);
$swimlane = $this->client->getSwimlaneById($swimlane_id);
$this->assertNotEmpty($swimlane);
$this->assertInternalType('array', $swimlane);
$this->assertEquals('Swimlane 1', $swimlane['name']);
}
public function testGetSwimlane()
{
$swimlane = $this->client->getSwimlane(1);
$this->assertNotEmpty($swimlane);
$this->assertInternalType('array', $swimlane);
$this->assertEquals('Swimlane 1', $swimlane['name']);
}
public function testUpdateSwimlane()
{
$swimlane = $this->client->getSwimlaneByName(1, 'Swimlane 1');
$this->assertNotEmpty($swimlane);
$this->assertInternalType('array', $swimlane);
$this->assertEquals(1, $swimlane['id']);
$this->assertEquals('Swimlane 1', $swimlane['name']);
$this->assertTrue($this->client->updateSwimlane($swimlane['id'], 'Another swimlane'));
$swimlane = $this->client->getSwimlaneById($swimlane['id']);
$this->assertNotEmpty($swimlane);
$this->assertEquals('Another swimlane', $swimlane['name']);
}
public function testDisableSwimlane()
{
$this->assertTrue($this->client->disableSwimlane(1, 1));
$swimlane = $this->client->getSwimlaneById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(0, $swimlane['is_active']);
}
public function testEnableSwimlane()
{
$this->assertTrue($this->client->enableSwimlane(1, 1));
$swimlane = $this->client->getSwimlaneById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(1, $swimlane['is_active']);
}
public function testGetAllSwimlanes()
{
$this->assertNotFalse($this->client->addSwimlane(1, 'Swimlane A'));
$swimlanes = $this->client->getAllSwimlanes(1);
$this->assertNotEmpty($swimlanes);
$this->assertCount(2, $swimlanes);
$this->assertEquals('Another swimlane', $swimlanes[0]['name']);
$this->assertEquals('Swimlane A', $swimlanes[1]['name']);
}
public function testGetActiveSwimlane()
{
$this->assertTrue($this->client->disableSwimlane(1, 1));
$swimlanes = $this->client->getActiveSwimlanes(1);
$this->assertNotEmpty($swimlanes);
$this->assertCount(2, $swimlanes);
$this->assertEquals('Default swimlane', $swimlanes[0]['name']);
$this->assertEquals('Swimlane A', $swimlanes[1]['name']);
}
public function testMoveSwimlaneUp()
{
$this->assertTrue($this->client->enableSwimlane(1, 1));
$this->assertTrue($this->client->moveSwimlaneUp(1, 1));
$swimlanes = $this->client->getActiveSwimlanes(1);
$this->assertNotEmpty($swimlanes);
$this->assertCount(3, $swimlanes);
$this->assertEquals('Default swimlane', $swimlanes[0]['name']);
$this->assertEquals('Another swimlane', $swimlanes[1]['name']);
$this->assertEquals('Swimlane A', $swimlanes[2]['name']);
$this->assertTrue($this->client->moveSwimlaneUp(1, 2));
$swimlanes = $this->client->getActiveSwimlanes(1);
$this->assertNotEmpty($swimlanes);
$this->assertCount(3, $swimlanes);
$this->assertEquals('Default swimlane', $swimlanes[0]['name']);
$this->assertEquals('Swimlane A', $swimlanes[1]['name']);
$this->assertEquals('Another swimlane', $swimlanes[2]['name']);
}
public function testMoveSwimlaneDown()
{
$this->assertTrue($this->client->moveSwimlaneDown(1, 2));
$swimlanes = $this->client->getActiveSwimlanes(1);
$this->assertNotEmpty($swimlanes);
$this->assertCount(3, $swimlanes);
$this->assertEquals('Default swimlane', $swimlanes[0]['name']);
$this->assertEquals('Another swimlane', $swimlanes[1]['name']);
$this->assertEquals('Swimlane A', $swimlanes[2]['name']);
}
public function testCreateTaskWithWrongMember()
{
$task = array(
@@ -394,18 +278,6 @@ class Api extends PHPUnit_Framework_TestCase
$this->assertNotEquals($moved_timestamp, $task['date_moved']);
}
public function testRemoveSwimlane()
{
$this->assertTrue($this->client->removeSwimlane(1, 2));
$task = $this->client->getTask($this->getTaskId());
$this->assertNotFalse($task);
$this->assertTrue(is_array($task));
$this->assertEquals(1, $task['position']);
$this->assertEquals(4, $task['column_id']);
$this->assertEquals(0, $task['swimlane_id']);
}
public function testUpdateTask()
{
$task = $this->client->getTask(1);