Be able to disable the login form for specific users

This commit is contained in:
Frederic Guillot
2015-02-07 23:28:17 -05:00
parent 607d9dc794
commit 00b9508d81
25 changed files with 148 additions and 69 deletions

View File

@@ -229,13 +229,13 @@ class ProjectDuplicationTest extends Base
$this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1)));
$this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
$this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, function() {});
$this->container['dispatcher']->addListener(Task::EVENT_CREATE, function() {});
$this->assertEquals(2, $pd->duplicate(1, array('category', 'action', 'swimlane', 'task')));
$this->assertNotFalse($pd->duplicate(1, array('category', 'action', 'swimlane', 'task')));
$project = $p->getByName('P1 (Clone)');
$this->assertNotFalse($project);
$project_id = $project['id'];
// Check if Swimlanes have been duplicated
$swimlanes = $s->getAll(2);
$swimlanes = $s->getAll($project_id);
$this->assertCount(3, $swimlanes);
$this->assertEquals(4, $swimlanes[0]['id']);
@@ -244,37 +244,59 @@ class ProjectDuplicationTest extends Base
$this->assertEquals('S2', $swimlanes[1]['name']);
$this->assertEquals(6, $swimlanes[2]['id']);
$this->assertEquals('S3', $swimlanes[2]['name']);
$new_default = $s->getDefault(2);
$new_default = $s->getDefault($project_id);
$this->assertEquals('New Default', $new_default['default_swimlane']);
// Check if Tasks have been duplicated
$tasks = $tf->getAll(2);
$tasks = $tf->getAll($project_id);
$this->assertCount(3, $tasks);
$this->assertEquals(4, $tasks[0]['id']);
// $this->assertEquals(4, $tasks[0]['id']);
$this->assertEquals('T1', $tasks[0]['title']);
$this->assertEquals(5, $tasks[1]['id']);
// $this->assertEquals(5, $tasks[1]['id']);
$this->assertEquals('T2', $tasks[1]['title']);
$this->assertEquals(6, $tasks[2]['id']);
// $this->assertEquals(6, $tasks[2]['id']);
$this->assertEquals('T3', $tasks[2]['title']);
// Drop project
unset($tasks);
unset($swimlanes);
unset($new_default);
$p->remove($project_id);
$p->remove(2);
$this->assertFalse($p->exists($project_id));
$this->assertCount(0, $s->getAll($project_id));
$this->assertCount(0, $tf->getAll($project_id));
}
$this->assertFalse($p->exists(2));
$this->assertCount(0, $s->getAll(2));
$this->assertCount(0, $tf->getAll(2));
public function testCloneProjectWithSwimlanes()
{
$p = new Project($this->container);
$pd = new ProjectDuplication($this->container);
$s = new Swimlane($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
// Check duplication with Swimlanes only
$this->assertEquals(2, $pd->duplicate(1, array('category', 'action', 'swimlane')));
$this->assertEquals(1, $p->create(array('name' => 'P1')));
// Check if Swimlanes have been duplicated
$swimlanes = $s->getAll(2);
// create initial swimlanes
$this->assertEquals(1, $s->create(1, 'S1'));
$this->assertEquals(2, $s->create(1, 'S2'));
$this->assertEquals(3, $s->create(1, 'S3'));
$default_swimlane1 = $s->getDefault(1);
$default_swimlane1['default_swimlane'] = 'New Default';
$this->assertTrue($s->updateDefault($default_swimlane1));
//create initial tasks
$this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1)));
$this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1)));
$this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
$this->assertNotFalse($pd->duplicate(1, array('category', 'action', 'swimlane')));
$project = $p->getByName('P1 (Clone)');
$this->assertNotFalse($project);
$project_id = $project['id'];
$swimlanes = $s->getAll($project_id);
$this->assertCount(3, $swimlanes);
$this->assertEquals(4, $swimlanes[0]['id']);
@@ -283,38 +305,55 @@ class ProjectDuplicationTest extends Base
$this->assertEquals('S2', $swimlanes[1]['name']);
$this->assertEquals(6, $swimlanes[2]['id']);
$this->assertEquals('S3', $swimlanes[2]['name']);
$new_default = $s->getDefault(2);
$new_default = $s->getDefault($project_id);
$this->assertEquals('New Default', $new_default['default_swimlane']);
// Check if Tasks have NOT been duplicated
$this->assertCount(0, $tf->getAll(2));
$this->assertCount(0, $tf->getAll($project_id));
}
// Drop project
unset($tasks);
unset($swimlanes);
unset($new_default);
public function testCloneProjectWithTasks()
{
$p = new Project($this->container);
$pd = new ProjectDuplication($this->container);
$s = new Swimlane($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$p->remove(2);
$this->assertEquals(1, $p->create(array('name' => 'P1')));
$this->assertFalse($p->exists(2));
$this->assertCount(0, $s->getAll(2));
$this->assertCount(0, $tf->getAll(2));
// create initial swimlanes
$this->assertEquals(1, $s->create(1, 'S1'));
$this->assertEquals(2, $s->create(1, 'S2'));
$this->assertEquals(3, $s->create(1, 'S3'));
// Check duplication with Tasks only
$this->assertEquals(2, $pd->duplicate(1, array('category', 'action', 'task')));
$default_swimlane1 = $s->getDefault(1);
$default_swimlane1['default_swimlane'] = 'New Default';
$this->assertTrue($s->updateDefault($default_swimlane1));
//create initial tasks
$this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1)));
$this->assertEquals(2, $tc->create(array('title' => 'T2', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 1)));
$this->assertEquals(3, $tc->create(array('title' => 'T3', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
$this->assertNotFalse($pd->duplicate(1, array('category', 'action', 'task')));
$project = $p->getByName('P1 (Clone)');
$this->assertNotFalse($project);
$project_id = $project['id'];
// Check if Swimlanes have NOT been duplicated
$this->assertCount(0, $s->getAll(2));
$this->assertCount(0, $s->getAll($project_id));
// Check if Tasks have been duplicated
$tasks = $tf->getAll(2);
$tasks = $tf->getAll($project_id);
$this->assertCount(3, $tasks);
$this->assertEquals(4, $tasks[0]['id']);
//$this->assertEquals(4, $tasks[0]['id']);
$this->assertEquals('T1', $tasks[0]['title']);
$this->assertEquals(5, $tasks[1]['id']);
//$this->assertEquals(5, $tasks[1]['id']);
$this->assertEquals('T2', $tasks[1]['title']);
$this->assertEquals(6, $tasks[2]['id']);
//$this->assertEquals(6, $tasks[2]['id']);
$this->assertEquals('T3', $tasks[2]['title']);
}
}