diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-10-08 09:58:11 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-10-08 09:58:11 -0400 |
commit | c2f1cc8f7419fe4eb5e9bd5e6ce05d90e719be17 (patch) | |
tree | 93900cc242574a346f14e2002f050b5f2c7dc55e /tests/units/Validator/ProjectValidatorTest.php | |
parent | 1466afb771f0291bc350441aede14c97459128e7 (diff) |
Restrict task complexity to a specific range to avoid integer overflow
Diffstat (limited to 'tests/units/Validator/ProjectValidatorTest.php')
-rw-r--r-- | tests/units/Validator/ProjectValidatorTest.php | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/units/Validator/ProjectValidatorTest.php b/tests/units/Validator/ProjectValidatorTest.php index e1e2f077..212c5317 100644 --- a/tests/units/Validator/ProjectValidatorTest.php +++ b/tests/units/Validator/ProjectValidatorTest.php @@ -9,65 +9,65 @@ class ProjectValidatorTest extends Base { public function testValidateCreation() { - $validator = new ProjectValidator($this->container); - $p = new ProjectModel($this->container); + $projectValidator = new ProjectValidator($this->container); + $projectModel = new ProjectModel($this->container); - $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); - $this->assertEquals(2, $p->create(array('name' => 'UnitTest2'))); + $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'UnitTest2'))); - $project = $p->getById(1); + $project = $projectModel->getById(1); $this->assertNotEmpty($project); $this->assertEquals('TEST1', $project['identifier']); - $project = $p->getById(2); + $project = $projectModel->getById(2); $this->assertNotEmpty($project); $this->assertEquals('', $project['identifier']); - $r = $validator->validateCreation(array('name' => 'test', 'identifier' => 'TEST1')); + $r = $projectValidator->validateCreation(array('name' => 'test', 'identifier' => 'TEST1')); $this->assertFalse($r[0]); - $r = $validator->validateCreation(array('name' => 'test', 'identifier' => 'test1')); + $r = $projectValidator->validateCreation(array('name' => 'test', 'identifier' => 'test1')); $this->assertFalse($r[0]); - $r = $validator->validateCreation(array('name' => 'test', 'identifier' => 'a-b-c')); + $r = $projectValidator->validateCreation(array('name' => 'test', 'identifier' => 'a-b-c')); $this->assertFalse($r[0]); - $r = $validator->validateCreation(array('name' => 'test', 'identifier' => 'test 123')); + $r = $projectValidator->validateCreation(array('name' => 'test', 'identifier' => 'test 123')); $this->assertFalse($r[0]); } public function testValidateModification() { - $validator = new ProjectValidator($this->container); - $p = new ProjectModel($this->container); + $projectValidator = new ProjectValidator($this->container); + $projectModel = new ProjectModel($this->container); - $this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); - $this->assertEquals(2, $p->create(array('name' => 'UnitTest2', 'identifier' => 'TEST2'))); + $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest1', 'identifier' => 'test1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'UnitTest2', 'identifier' => 'TEST2'))); - $project = $p->getById(1); + $project = $projectModel->getById(1); $this->assertNotEmpty($project); $this->assertEquals('TEST1', $project['identifier']); - $project = $p->getById(2); + $project = $projectModel->getById(2); $this->assertNotEmpty($project); $this->assertEquals('TEST2', $project['identifier']); - $r = $validator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1')); + $r = $projectValidator->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1')); $this->assertTrue($r[0]); - $r = $validator->validateModification(array('id' => 1, 'identifier' => 'test3')); + $r = $projectValidator->validateModification(array('id' => 1, 'identifier' => 'test3')); $this->assertTrue($r[0]); - $r = $validator->validateModification(array('id' => 1, 'identifier' => '')); + $r = $projectValidator->validateModification(array('id' => 1, 'identifier' => '')); $this->assertTrue($r[0]); - $r = $validator->validateModification(array('id' => 1, 'identifier' => 'TEST2')); + $r = $projectValidator->validateModification(array('id' => 1, 'identifier' => 'TEST2')); $this->assertFalse($r[0]); - $r = $validator->validateModification(array('id' => 1, 'name' => '')); + $r = $projectValidator->validateModification(array('id' => 1, 'name' => '')); $this->assertFalse($r[0]); - $r = $validator->validateModification(array('id' => 1, 'name' => null)); + $r = $projectValidator->validateModification(array('id' => 1, 'name' => null)); $this->assertFalse($r[0]); } } |