summaryrefslogtreecommitdiff
path: root/tests/integration/ColumnProcedureTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-06-26 10:25:13 -0400
committerFrederic Guillot <fred@kanboard.net>2016-06-26 10:25:13 -0400
commit4a230d331ec220fc32a48525afb308af0d9787fa (patch)
tree514aa3d703155b7f97a2c77147c9fd74cef60f84 /tests/integration/ColumnProcedureTest.php
parent922e0fb6de06a98774418612e0b0f75af72b6dbb (diff)
Added application and project roles validation for API procedure calls
Diffstat (limited to 'tests/integration/ColumnProcedureTest.php')
-rw-r--r--tests/integration/ColumnProcedureTest.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/integration/ColumnProcedureTest.php b/tests/integration/ColumnProcedureTest.php
new file mode 100644
index 00000000..fb6a27c3
--- /dev/null
+++ b/tests/integration/ColumnProcedureTest.php
@@ -0,0 +1,69 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class ColumnProcedureTest extends BaseProcedureTest
+{
+ protected $projectName = 'My project to test columns';
+ private $columns = array();
+
+ public function testAll()
+ {
+ $this->assertCreateTeamProject();
+ $this->assertGetColumns();
+ $this->assertUpdateColumn();
+ $this->assertAddColumn();
+ $this->assertRemoveColumn();
+ $this->assertChangeColumnPosition();
+ }
+
+ public function assertGetColumns()
+ {
+ $this->columns = $this->app->getColumns($this->projectId);
+ $this->assertCount(4, $this->columns);
+ $this->assertEquals('Done', $this->columns[3]['title']);
+ }
+
+ public function assertUpdateColumn()
+ {
+ $this->assertTrue($this->app->updateColumn($this->columns[3]['id'], 'Another column', 2));
+
+ $this->columns = $this->app->getColumns($this->projectId);
+ $this->assertEquals('Another column', $this->columns[3]['title']);
+ $this->assertEquals(2, $this->columns[3]['task_limit']);
+ }
+
+ public function assertAddColumn()
+ {
+ $column_id = $this->app->addColumn($this->projectId, 'New column');
+ $this->assertNotFalse($column_id);
+ $this->assertTrue($column_id > 0);
+
+ $this->columns = $this->app->getColumns($this->projectId);
+ $this->assertCount(5, $this->columns);
+ $this->assertEquals('New column', $this->columns[4]['title']);
+ }
+
+ public function assertRemoveColumn()
+ {
+ $this->assertTrue($this->app->removeColumn($this->columns[3]['id']));
+
+ $this->columns = $this->app->getColumns($this->projectId);
+ $this->assertCount(4, $this->columns);
+ }
+
+ public function assertChangeColumnPosition()
+ {
+ $this->assertTrue($this->app->changeColumnPosition($this->projectId, $this->columns[0]['id'], 3));
+
+ $this->columns = $this->app->getColumns($this->projectId);
+ $this->assertEquals('Ready', $this->columns[0]['title']);
+ $this->assertEquals(1, $this->columns[0]['position']);
+ $this->assertEquals('Work in progress', $this->columns[1]['title']);
+ $this->assertEquals(2, $this->columns[1]['position']);
+ $this->assertEquals('Backlog', $this->columns[2]['title']);
+ $this->assertEquals(3, $this->columns[2]['position']);
+ $this->assertEquals('New column', $this->columns[3]['title']);
+ $this->assertEquals(4, $this->columns[3]['position']);
+ }
+}