summaryrefslogtreecommitdiff
path: root/tests/units/Model/ColumnMoveRestrictionModelTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Model/ColumnMoveRestrictionModelTest.php')
-rw-r--r--tests/units/Model/ColumnMoveRestrictionModelTest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/units/Model/ColumnMoveRestrictionModelTest.php b/tests/units/Model/ColumnMoveRestrictionModelTest.php
index 9227012b..3bef6f99 100644
--- a/tests/units/Model/ColumnMoveRestrictionModelTest.php
+++ b/tests/units/Model/ColumnMoveRestrictionModelTest.php
@@ -32,6 +32,54 @@ class ColumnMoveRestrictionModelTest extends Base
$this->assertTrue($columnMoveRestrictionModel->remove(1));
}
+ public function testGetById()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $projectRoleModel = new ProjectRoleModel($this->container);
+ $columnMoveRestrictionModel = new ColumnMoveRestrictionModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'Test')));
+ $this->assertEquals(1, $projectRoleModel->create(1, 'Role A'));
+ $this->assertEquals(1, $columnMoveRestrictionModel->create(1, 1, 2, 3));
+
+ $restriction = $columnMoveRestrictionModel->getById(1, 1);
+ $this->assertEquals(1, $restriction['restriction_id']);
+ $this->assertEquals('Role A', $restriction['role']);
+ $this->assertEquals(1, $restriction['role_id']);
+ $this->assertEquals(1, $restriction['project_id']);
+ $this->assertEquals('Ready', $restriction['src_column_title']);
+ $this->assertEquals('Work in progress', $restriction['dst_column_title']);
+ $this->assertEquals(2, $restriction['src_column_id']);
+ $this->assertEquals(3, $restriction['dst_column_id']);
+ }
+
+ public function testGetSrcColumns()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $projectRoleModel = new ProjectRoleModel($this->container);
+ $columnMoveRestrictionModel = new ColumnMoveRestrictionModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'Test')));
+
+ $this->assertEquals(1, $projectRoleModel->create(1, 'Role A'));
+ $this->assertEquals(2, $projectRoleModel->create(1, 'Role B'));
+ $this->assertEquals(3, $projectRoleModel->create(2, 'Role C'));
+
+ $this->assertEquals(1, $columnMoveRestrictionModel->create(1, 1, 2, 3));
+ $this->assertEquals(2, $columnMoveRestrictionModel->create(1, 2, 3, 4));
+
+ $columnIds = $columnMoveRestrictionModel->getAllSrcColumns(1, 'Role A');
+ $this->assertEquals(2, $columnIds[2]);
+
+ $this->assertEmpty($columnMoveRestrictionModel->getAllSrcColumns(2, 'Role A'));
+ $this->assertEmpty($columnMoveRestrictionModel->getAllSrcColumns(2, 'Role C'));
+
+ $columnIds = $columnMoveRestrictionModel->getAllSrcColumns(1, 'Role B');
+ $this->assertEquals(3, $columnIds[3]);
+ }
+
public function testGetAll()
{
$projectModel = new ProjectModel($this->container);
@@ -53,6 +101,8 @@ class ColumnMoveRestrictionModelTest extends Base
$this->assertEquals(1, $restrictions[0]['restriction_id']);
$this->assertEquals('Role A', $restrictions[0]['role']);
+ $this->assertEquals(1, $restrictions[0]['role_id']);
+ $this->assertEquals(1, $restrictions[0]['project_id']);
$this->assertEquals('Ready', $restrictions[0]['src_column_title']);
$this->assertEquals('Work in progress', $restrictions[0]['dst_column_title']);
$this->assertEquals(2, $restrictions[0]['src_column_id']);