diff options
Diffstat (limited to 'tests/integration/SwimlaneTest.php')
-rw-r--r-- | tests/integration/SwimlaneTest.php | 86 |
1 files changed, 38 insertions, 48 deletions
diff --git a/tests/integration/SwimlaneTest.php b/tests/integration/SwimlaneTest.php index 88747204..4f703414 100644 --- a/tests/integration/SwimlaneTest.php +++ b/tests/integration/SwimlaneTest.php @@ -1,103 +1,93 @@ <?php -require_once __DIR__.'/Base.php'; +require_once __DIR__.'/BaseIntegrationTest.php'; -class SwimlaneTest extends Base +class SwimlaneTest extends BaseIntegrationTest { - public function testCreateProject() + protected $projectName = 'My project to test swimlanes'; + private $swimlaneId = 0; + + public function testAll() { - $this->assertEquals(1, $this->app->createProject('A project')); + $this->assertCreateTeamProject(); } - public function testGetDefaultSwimlane() + public function assertGetDefaultSwimlane() { - $swimlane = $this->app->getDefaultSwimlane(1); + $swimlane = $this->app->getDefaultSwimlane($this->projectId); $this->assertNotEmpty($swimlane); $this->assertEquals('Default swimlane', $swimlane['default_swimlane']); } - public function testAddSwimlane() + public function assertAddSwimlane() { - $swimlane_id = $this->app->addSwimlane(1, 'Swimlane 1'); - $this->assertNotFalse($swimlane_id); - $this->assertInternalType('int', $swimlane_id); - - $swimlane = $this->app->getSwimlaneById($swimlane_id); - $this->assertNotEmpty($swimlane); - $this->assertInternalType('array', $swimlane); - $this->assertEquals('Swimlane 1', $swimlane['name']); + $this->swimlaneId = $this->app->addSwimlane($this->projectId, 'Swimlane 1'); + $this->assertNotFalse($this->swimlaneId); + $this->assertNotFalse($this->app->addSwimlane($this->projectId, 'Swimlane 2')); } - public function testGetSwimlane() + public function assertGetSwimlane() { - $swimlane = $this->app->getSwimlane(1); + $swimlane = $this->app->getSwimlane($this->swimlaneId); $this->assertInternalType('array', $swimlane); $this->assertEquals('Swimlane 1', $swimlane['name']); } - public function testUpdateSwimlane() + public function assertUpdateSwimlane() { - $swimlane = $this->app->getSwimlaneByName(1, 'Swimlane 1'); - $this->assertInternalType('array', $swimlane); - $this->assertEquals(1, $swimlane['id']); - $this->assertEquals('Swimlane 1', $swimlane['name']); + $this->assertTrue($this->app->updateSwimlane($this->swimlaneId, 'Another swimlane')); - $this->assertTrue($this->app->updateSwimlane($swimlane['id'], 'Another swimlane')); - - $swimlane = $this->app->getSwimlaneById($swimlane['id']); + $swimlane = $this->app->getSwimlaneById($this->swimlaneId); $this->assertEquals('Another swimlane', $swimlane['name']); } - public function testDisableSwimlane() + public function assertDisableSwimlane() { - $this->assertTrue($this->app->disableSwimlane(1, 1)); + $this->assertTrue($this->app->disableSwimlane($this->projectId, $this->swimlaneId)); - $swimlane = $this->app->getSwimlaneById(1); + $swimlane = $this->app->getSwimlaneById($this->swimlaneId); $this->assertEquals(0, $swimlane['is_active']); } - public function testEnableSwimlane() + public function assertEnableSwimlane() { - $this->assertTrue($this->app->enableSwimlane(1, 1)); + $this->assertTrue($this->app->enableSwimlane($this->projectId, $this->swimlaneId)); - $swimlane = $this->app->getSwimlaneById(1); + $swimlane = $this->app->getSwimlaneById($this->swimlaneId); $this->assertEquals(1, $swimlane['is_active']); } - public function testGetAllSwimlanes() + public function assertGetAllSwimlanes() { - $this->assertNotFalse($this->app->addSwimlane(1, 'Swimlane A')); - - $swimlanes = $this->app->getAllSwimlanes(1); + $swimlanes = $this->app->getAllSwimlanes($this->projectId); $this->assertCount(2, $swimlanes); $this->assertEquals('Another swimlane', $swimlanes[0]['name']); - $this->assertEquals('Swimlane A', $swimlanes[1]['name']); + $this->assertEquals('Swimlane 2', $swimlanes[1]['name']); } - public function testGetActiveSwimlane() + public function assertGetActiveSwimlane() { - $this->assertTrue($this->app->disableSwimlane(1, 1)); + $this->assertTrue($this->app->disableSwimlane($this->projectId, $this->swimlaneId)); - $swimlanes = $this->app->getActiveSwimlanes(1); + $swimlanes = $this->app->getActiveSwimlanes($this->projectId); $this->assertCount(2, $swimlanes); $this->assertEquals('Default swimlane', $swimlanes[0]['name']); - $this->assertEquals('Swimlane A', $swimlanes[1]['name']); + $this->assertEquals('Swimlane 2', $swimlanes[1]['name']); } - public function testRemoveSwimlane() + public function assertRemoveSwimlane() { - $this->assertTrue($this->app->removeSwimlane(1, 2)); + $this->assertTrue($this->app->removeSwimlane($this->projectId, $this->swimlaneId)); } - public function testChangePosition() + public function assertChangePosition() { - $this->assertNotFalse($this->app->addSwimlane(1, 'Swimlane 1')); - $this->assertNotFalse($this->app->addSwimlane(1, 'Swimlane 2')); + $swimlaneId1 = $this->app->addSwimlane($this->projectId, 'Swimlane A'); + $this->assertNotFalse($this->app->addSwimlane($this->projectId, 'Swimlane B')); - $swimlanes = $this->app->getAllSwimlanes(1); + $swimlanes = $this->app->getAllSwimlanes($this->projectId); $this->assertCount(3, $swimlanes); - $this->assertTrue($this->app->changeSwimlanePosition(1, 1, 3)); - $this->assertFalse($this->app->changeSwimlanePosition(1, 1, 6)); + $this->assertTrue($this->app->changeSwimlanePosition($this->projectId, $swimlaneId1, 3)); } } |