Split Board model into multiple classes
This commit is contained in:
@@ -170,76 +170,6 @@ class Api extends PHPUnit_Framework_TestCase
|
||||
$this->assertCount(0, $activities);
|
||||
}
|
||||
|
||||
public function testGetBoard()
|
||||
{
|
||||
$board = $this->client->getBoard(1);
|
||||
$this->assertTrue(is_array($board));
|
||||
$this->assertEquals(1, count($board));
|
||||
$this->assertEquals('Default swimlane', $board[0]['name']);
|
||||
$this->assertEquals(4, count($board[0]['columns']));
|
||||
}
|
||||
|
||||
public function testGetColumns()
|
||||
{
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals(4, count($columns));
|
||||
$this->assertEquals('Done', $columns[3]['title']);
|
||||
}
|
||||
|
||||
public function testMoveColumnUp()
|
||||
{
|
||||
$this->assertTrue($this->client->moveColumnUp(1, 4));
|
||||
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals('Done', $columns[2]['title']);
|
||||
$this->assertEquals('Work in progress', $columns[3]['title']);
|
||||
}
|
||||
|
||||
public function testMoveColumnDown()
|
||||
{
|
||||
$this->assertTrue($this->client->moveColumnDown(1, 4));
|
||||
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals('Work in progress', $columns[2]['title']);
|
||||
$this->assertEquals('Done', $columns[3]['title']);
|
||||
}
|
||||
|
||||
public function testUpdateColumn()
|
||||
{
|
||||
$this->assertTrue($this->client->updateColumn(4, 'Boo', 2));
|
||||
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals('Boo', $columns[3]['title']);
|
||||
$this->assertEquals(2, $columns[3]['task_limit']);
|
||||
}
|
||||
|
||||
public function testAddColumn()
|
||||
{
|
||||
$column_id = $this->client->addColumn(1, 'New column');
|
||||
|
||||
$this->assertNotFalse($column_id);
|
||||
$this->assertInternalType('int', $column_id);
|
||||
$this->assertTrue($column_id > 0);
|
||||
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals(5, count($columns));
|
||||
$this->assertEquals('New column', $columns[4]['title']);
|
||||
}
|
||||
|
||||
public function testRemoveColumn()
|
||||
{
|
||||
$this->assertTrue($this->client->removeColumn(5));
|
||||
|
||||
$columns = $this->client->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
$this->assertEquals(4, count($columns));
|
||||
}
|
||||
|
||||
public function testGetDefaultSwimlane()
|
||||
{
|
||||
$swimlane = $this->client->getDefaultSwimlane(1);
|
||||
|
||||
21
tests/integration/BoardTest.php
Normal file
21
tests/integration/BoardTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/Base.php';
|
||||
|
||||
class BoardTest extends Base
|
||||
{
|
||||
public function testCreateProject()
|
||||
{
|
||||
$this->assertEquals(1, $this->app->createProject('A project'));
|
||||
}
|
||||
|
||||
public function testGetBoard()
|
||||
{
|
||||
$board = $this->app->getBoard(1);
|
||||
$this->assertCount(1, $board);
|
||||
$this->assertEquals('Default swimlane', $board[0]['name']);
|
||||
|
||||
$this->assertCount(4, $board[0]['columns']);
|
||||
$this->assertEquals('Ready', $board[0]['columns'][1]['title']);
|
||||
}
|
||||
}
|
||||
65
tests/integration/ColumnTest.php
Normal file
65
tests/integration/ColumnTest.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/Base.php';
|
||||
|
||||
class ColumnTest extends Base
|
||||
{
|
||||
public function testCreateProject()
|
||||
{
|
||||
$this->assertEquals(1, $this->app->createProject('A project'));
|
||||
}
|
||||
|
||||
public function testGetColumns()
|
||||
{
|
||||
$columns = $this->app->getColumns($this->getProjectId());
|
||||
$this->assertCount(4, $columns);
|
||||
$this->assertEquals('Done', $columns[3]['title']);
|
||||
}
|
||||
|
||||
public function testUpdateColumn()
|
||||
{
|
||||
$this->assertTrue($this->app->updateColumn(4, 'Boo', 2));
|
||||
|
||||
$columns = $this->app->getColumns($this->getProjectId());
|
||||
$this->assertEquals('Boo', $columns[3]['title']);
|
||||
$this->assertEquals(2, $columns[3]['task_limit']);
|
||||
}
|
||||
|
||||
public function testAddColumn()
|
||||
{
|
||||
$column_id = $this->app->addColumn($this->getProjectId(), 'New column');
|
||||
|
||||
$this->assertNotFalse($column_id);
|
||||
$this->assertInternalType('int', $column_id);
|
||||
$this->assertTrue($column_id > 0);
|
||||
|
||||
$columns = $this->app->getColumns($this->getProjectId());
|
||||
$this->assertCount(5, $columns);
|
||||
$this->assertEquals('New column', $columns[4]['title']);
|
||||
}
|
||||
|
||||
public function testRemoveColumn()
|
||||
{
|
||||
$this->assertTrue($this->app->removeColumn(5));
|
||||
|
||||
$columns = $this->app->getColumns($this->getProjectId());
|
||||
$this->assertCount(4, $columns);
|
||||
}
|
||||
|
||||
public function testChangeColumnPosition()
|
||||
{
|
||||
$this->assertTrue($this->app->changeColumnPosition($this->getProjectId(), 1, 3));
|
||||
|
||||
$columns = $this->app->getColumns($this->getProjectId());
|
||||
$this->assertCount(4, $columns);
|
||||
|
||||
$this->assertEquals('Ready', $columns[0]['title']);
|
||||
$this->assertEquals(1, $columns[0]['position']);
|
||||
$this->assertEquals('Work in progress', $columns[1]['title']);
|
||||
$this->assertEquals(2, $columns[1]['position']);
|
||||
$this->assertEquals('Backlog', $columns[2]['title']);
|
||||
$this->assertEquals(3, $columns[2]['position']);
|
||||
$this->assertEquals('Boo', $columns[3]['title']);
|
||||
$this->assertEquals(4, $columns[3]['position']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user