diff options
Diffstat (limited to 'tests/units/Model')
-rw-r--r-- | tests/units/Model/ProjectTest.php | 25 | ||||
-rw-r--r-- | tests/units/Model/TaskLinkTest.php | 49 | ||||
-rw-r--r-- | tests/units/Model/UserTest.php | 32 |
3 files changed, 0 insertions, 106 deletions
diff --git a/tests/units/Model/ProjectTest.php b/tests/units/Model/ProjectTest.php index 4d8e6fc7..990cee5a 100644 --- a/tests/units/Model/ProjectTest.php +++ b/tests/units/Model/ProjectTest.php @@ -277,30 +277,5 @@ class ProjectTest extends Base $project = $p->getByIdentifier(''); $this->assertFalse($project); - - // Validation rules - $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'TEST1')); - $this->assertFalse($r[0]); - - $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test1')); - $this->assertFalse($r[0]); - - $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST1')); - $this->assertTrue($r[0]); - - $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'test3')); - $this->assertTrue($r[0]); - - $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => '')); - $this->assertTrue($r[0]); - - $r = $p->validateModification(array('id' => 1, 'name' => 'test', 'identifier' => 'TEST2')); - $this->assertFalse($r[0]); - - $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'a-b-c')); - $this->assertFalse($r[0]); - - $r = $p->validateCreation(array('name' => 'test', 'identifier' => 'test 123')); - $this->assertFalse($r[0]); } } diff --git a/tests/units/Model/TaskLinkTest.php b/tests/units/Model/TaskLinkTest.php index 4db42d99..192a4298 100644 --- a/tests/units/Model/TaskLinkTest.php +++ b/tests/units/Model/TaskLinkTest.php @@ -194,53 +194,4 @@ class TaskLinkTest extends Base $links = $tl->getAll(2); $this->assertEmpty($links); } - - public function testValidation() - { - $tl = new TaskLink($this->container); - $p = new Project($this->container); - $tc = new TaskCreation($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'))); - - $links = $tl->getAll(1); - $this->assertEmpty($links); - - $links = $tl->getAll(2); - $this->assertEmpty($links); - - // Check creation - $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2)); - $this->assertTrue($r[0]); - - $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1)); - $this->assertFalse($r[0]); - - $r = $tl->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2)); - $this->assertFalse($r[0]); - - $r = $tl->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2)); - $this->assertFalse($r[0]); - - $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1)); - $this->assertFalse($r[0]); - - // Check modification - $r = $tl->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2)); - $this->assertTrue($r[0]); - - $r = $tl->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1)); - $this->assertFalse($r[0]); - - $r = $tl->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2)); - $this->assertFalse($r[0]); - - $r = $tl->validateModification(array('id' => 1, 'task_id' => 1, 'opposite_task_id' => 2)); - $this->assertFalse($r[0]); - - $r = $tl->validateModification(array('id' => 1, 'task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1)); - $this->assertFalse($r[0]); - } } diff --git a/tests/units/Model/UserTest.php b/tests/units/Model/UserTest.php index 1d381006..0987fa56 100644 --- a/tests/units/Model/UserTest.php +++ b/tests/units/Model/UserTest.php @@ -391,36 +391,4 @@ class UserTest extends Base $this->assertEquals('toto', $user['username']); $this->assertEmpty($user['token']); } - - public function testValidatePasswordModification() - { - $u = new User($this->container); - - $this->container['sessionStorage']->user = array( - 'id' => 1, - 'role' => Role::APP_ADMIN, - 'username' => 'admin', - ); - - $result = $u->validatePasswordModification(array()); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1)); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1, 'password' => '123456')); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1, 'password' => '123456', 'confirmation' => 'wrong')); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1, 'password' => '123456', 'confirmation' => '123456')); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1, 'password' => '123456', 'confirmation' => '123456', 'current_password' => 'wrong')); - $this->assertFalse($result[0]); - - $result = $u->validatePasswordModification(array('id' => 1, 'password' => '123456', 'confirmation' => '123456', 'current_password' => 'admin')); - $this->assertTrue($result[0]); - } } |