diff options
Diffstat (limited to 'tests/units/Model')
-rw-r--r-- | tests/units/Model/CommentTest.php | 49 | ||||
-rw-r--r-- | tests/units/Model/CustomFilterTest.php | 28 | ||||
-rw-r--r-- | tests/units/Model/GroupTest.php | 22 | ||||
-rw-r--r-- | tests/units/Model/LinkTest.php | 46 |
4 files changed, 0 insertions, 145 deletions
diff --git a/tests/units/Model/CommentTest.php b/tests/units/Model/CommentTest.php index 07c39fe3..ec4e7a56 100644 --- a/tests/units/Model/CommentTest.php +++ b/tests/units/Model/CommentTest.php @@ -90,53 +90,4 @@ class CommentTest extends Base $this->assertFalse($c->remove(1)); $this->assertFalse($c->remove(1111)); } - - public function testValidateCreation() - { - $c = new Comment($this->container); - - $result = $c->validateCreation(array('user_id' => 1, 'task_id' => 1, 'comment' => 'bla')); - $this->assertTrue($result[0]); - - $result = $c->validateCreation(array('user_id' => 1, 'task_id' => 1, 'comment' => '')); - $this->assertFalse($result[0]); - - $result = $c->validateCreation(array('user_id' => 1, 'task_id' => 'a', 'comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateCreation(array('user_id' => 'b', 'task_id' => 1, 'comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateCreation(array('user_id' => 1, 'comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateCreation(array('task_id' => 1, 'comment' => 'bla')); - $this->assertTrue($result[0]); - - $result = $c->validateCreation(array('comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateCreation(array()); - $this->assertFalse($result[0]); - } - - public function testValidateModification() - { - $c = new Comment($this->container); - - $result = $c->validateModification(array('id' => 1, 'comment' => 'bla')); - $this->assertTrue($result[0]); - - $result = $c->validateModification(array('id' => 1, 'comment' => '')); - $this->assertFalse($result[0]); - - $result = $c->validateModification(array('comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateModification(array('id' => 'b', 'comment' => 'bla')); - $this->assertFalse($result[0]); - - $result = $c->validateModification(array()); - $this->assertFalse($result[0]); - } } diff --git a/tests/units/Model/CustomFilterTest.php b/tests/units/Model/CustomFilterTest.php index 190da899..a73bc401 100644 --- a/tests/units/Model/CustomFilterTest.php +++ b/tests/units/Model/CustomFilterTest.php @@ -52,34 +52,6 @@ class CustomFilterTest extends Base $this->assertEquals(1, $filter['is_shared']); } - public function testValidation() - { - $cf = new CustomFilter($this->container); - - // Validate creation - $r = $cf->validateCreation(array('filter' => 'test', 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertTrue($r[0]); - - $r = $cf->validateCreation(array('filter' => str_repeat('a', 101), 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertFalse($r[0]); - - $r = $cf->validateCreation(array('name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertFalse($r[0]); - - // Validate modification - $r = $cf->validateModification(array('id' => 1, 'filter' => 'test', 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertTrue($r[0]); - - $r = $cf->validateModification(array('filter' => 'test', 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertFalse($r[0]); - - $r = $cf->validateModification(array('id' => 1, 'filter' => str_repeat('a', 101), 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertFalse($r[0]); - - $r = $cf->validateModification(array('id' => 1, 'name' => 'test', 'user_id' => 1, 'project_id' => 1, 'is_shared' => 0)); - $this->assertFalse($r[0]); - } - public function testGetAll() { $u = new User($this->container); diff --git a/tests/units/Model/GroupTest.php b/tests/units/Model/GroupTest.php index 2cbb254a..36b47dc5 100644 --- a/tests/units/Model/GroupTest.php +++ b/tests/units/Model/GroupTest.php @@ -57,26 +57,4 @@ class GroupTest extends Base $this->assertTrue($groupModel->remove(1)); $this->assertEmpty($groupModel->getById(1)); } - - public function testValidateCreation() - { - $groupModel = new Group($this->container); - - $result = $groupModel->validateCreation(array('name' => 'Test')); - $this->assertTrue($result[0]); - - $result = $groupModel->validateCreation(array('name' => '')); - $this->assertFalse($result[0]); - } - - public function testValidateModification() - { - $groupModel = new Group($this->container); - - $result = $groupModel->validateModification(array('name' => 'Test', 'id' => 1)); - $this->assertTrue($result[0]); - - $result = $groupModel->validateModification(array('name' => 'Test')); - $this->assertFalse($result[0]); - } } diff --git a/tests/units/Model/LinkTest.php b/tests/units/Model/LinkTest.php index de9d843a..b102646d 100644 --- a/tests/units/Model/LinkTest.php +++ b/tests/units/Model/LinkTest.php @@ -124,50 +124,4 @@ class LinkTest extends Base $this->assertArrayNotHasKey(0, $links); $this->assertEquals('relates to', $links[1]); } - - public function testValidateCreation() - { - $l = new Link($this->container); - - $r = $l->validateCreation(array('label' => 'a')); - $this->assertTrue($r[0]); - - $r = $l->validateCreation(array('label' => 'a', 'opposite_label' => 'b')); - $this->assertTrue($r[0]); - - $r = $l->validateCreation(array('label' => 'relates to')); - $this->assertFalse($r[0]); - - $r = $l->validateCreation(array('label' => 'a', 'opposite_label' => 'a')); - $this->assertFalse($r[0]); - - $r = $l->validateCreation(array('label' => '')); - $this->assertFalse($r[0]); - } - - public function testValidateModification() - { - $l = new Link($this->container); - - $r = $l->validateModification(array('id' => 20, 'label' => 'a', 'opposite_id' => 0)); - $this->assertTrue($r[0]); - - $r = $l->validateModification(array('id' => 20, 'label' => 'a', 'opposite_id' => '1')); - $this->assertTrue($r[0]); - - $r = $l->validateModification(array('id' => 20, 'label' => 'relates to', 'opposite_id' => '1')); - $this->assertFalse($r[0]); - - $r = $l->validateModification(array('id' => 20, 'label' => '', 'opposite_id' => '1')); - $this->assertFalse($r[0]); - - $r = $l->validateModification(array('label' => '', 'opposite_id' => '1')); - $this->assertFalse($r[0]); - - $r = $l->validateModification(array('id' => 20, 'opposite_id' => '1')); - $this->assertFalse($r[0]); - - $r = $l->validateModification(array('label' => 'test')); - $this->assertFalse($r[0]); - } } |