summaryrefslogtreecommitdiff
path: root/tests/units/Validator/TaskLinkValidatorTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-10-08 09:58:11 -0400
committerFrederic Guillot <fred@kanboard.net>2016-10-08 09:58:11 -0400
commitc2f1cc8f7419fe4eb5e9bd5e6ce05d90e719be17 (patch)
tree93900cc242574a346f14e2002f050b5f2c7dc55e /tests/units/Validator/TaskLinkValidatorTest.php
parent1466afb771f0291bc350441aede14c97459128e7 (diff)
Restrict task complexity to a specific range to avoid integer overflow
Diffstat (limited to 'tests/units/Validator/TaskLinkValidatorTest.php')
-rw-r--r--tests/units/Validator/TaskLinkValidatorTest.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/units/Validator/TaskLinkValidatorTest.php b/tests/units/Validator/TaskLinkValidatorTest.php
index 5fc50e3e..414cf696 100644
--- a/tests/units/Validator/TaskLinkValidatorTest.php
+++ b/tests/units/Validator/TaskLinkValidatorTest.php
@@ -11,62 +11,62 @@ class TaskLinkValidatorTest extends Base
{
public function testValidateCreation()
{
- $validator = new TaskLinkValidator($this->container);
- $tl = new TaskLinkModel($this->container);
- $p = new ProjectModel($this->container);
- $tc = new TaskCreationModel($this->container);
+ $taskLinkValidator = new TaskLinkValidator($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
- $this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'B')));
- $links = $tl->getAll(1);
+ $links = $taskLinkModel->getAll(1);
$this->assertEmpty($links);
- $links = $tl->getAll(2);
+ $links = $taskLinkModel->getAll(2);
$this->assertEmpty($links);
// Check creation
- $r = $validator->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2));
$this->assertTrue($r[0]);
- $r = $validator->validateCreation(array('task_id' => 1, 'link_id' => 1));
+ $r = $taskLinkValidator->validateCreation(array('task_id' => 1, 'link_id' => 1));
$this->assertFalse($r[0]);
- $r = $validator->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
$this->assertFalse($r[0]);
- $r = $validator->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
$this->assertFalse($r[0]);
- $r = $validator->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1));
+ $r = $taskLinkValidator->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1));
$this->assertFalse($r[0]);
}
public function testValidateModification()
{
- $validator = new TaskLinkValidator($this->container);
- $p = new ProjectModel($this->container);
- $tc = new TaskCreationModel($this->container);
+ $taskLinkValidator = new TaskLinkValidator($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
- $this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'B')));
// Check modification
- $r = $validator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2));
$this->assertTrue($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1));
+ $r = $taskLinkValidator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1));
$this->assertFalse($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2));
$this->assertFalse($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2));
+ $r = $taskLinkValidator->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2));
$this->assertFalse($r[0]);
- $r = $validator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1));
+ $r = $taskLinkValidator->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1));
$this->assertFalse($r[0]);
}
}