addColumn() return the column_id now
This commit is contained in:
@@ -109,16 +109,18 @@ class Board extends Base
|
|||||||
* @param integer $project_id Project id
|
* @param integer $project_id Project id
|
||||||
* @param string $title Column title
|
* @param string $title Column title
|
||||||
* @param integer $task_limit Task limit
|
* @param integer $task_limit Task limit
|
||||||
* @return boolean
|
* @return boolean|integer
|
||||||
*/
|
*/
|
||||||
public function addColumn($project_id, $title, $task_limit = 0)
|
public function addColumn($project_id, $title, $task_limit = 0)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)->save(array(
|
$values = array(
|
||||||
'project_id' => $project_id,
|
'project_id' => $project_id,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'task_limit' => $task_limit,
|
'task_limit' => $task_limit,
|
||||||
'position' => $this->getLastColumnPosition($project_id) + 1,
|
'position' => $this->getLastColumnPosition($project_id) + 1,
|
||||||
));
|
);
|
||||||
|
|
||||||
|
return $this->persist(self::TABLE, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -869,7 +869,7 @@ Response example:
|
|||||||
- **project_id** (integer, required)
|
- **project_id** (integer, required)
|
||||||
- **title** (string, required)
|
- **title** (string, required)
|
||||||
- **task_limit** (integer, optional)
|
- **task_limit** (integer, optional)
|
||||||
- Result on success: **true**
|
- Result on success: **column_id**
|
||||||
- Result on failure: **false**
|
- Result on failure: **false**
|
||||||
|
|
||||||
Request example:
|
Request example:
|
||||||
@@ -892,7 +892,7 @@ Response example:
|
|||||||
{
|
{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 638544704,
|
"id": 638544704,
|
||||||
"result": true
|
"result": 5
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,11 @@ class Api extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testAddColumn()
|
public function testAddColumn()
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->client->addColumn(1, 'New column'));
|
$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);
|
$columns = $this->client->getColumns(1);
|
||||||
$this->assertTrue(is_array($columns));
|
$this->assertTrue(is_array($columns));
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ class BoardTest extends Base
|
|||||||
$b = new Board($this->container);
|
$b = new Board($this->container);
|
||||||
|
|
||||||
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
|
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
|
||||||
$this->assertTrue($b->addColumn(1, 'another column'));
|
$this->assertNotFalse($b->addColumn(1, 'another column'));
|
||||||
$this->assertTrue($b->addColumn(1, 'one more', 3));
|
$this->assertNotFalse($b->addColumn(1, 'one more', 3));
|
||||||
|
|
||||||
$columns = $b->getColumns(1);
|
$columns = $b->getColumns(1);
|
||||||
$this->assertTrue(is_array($columns));
|
$this->assertTrue(is_array($columns));
|
||||||
|
|||||||
Reference in New Issue
Block a user