summaryrefslogtreecommitdiff
path: root/tests/CommentTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-26 14:41:19 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-26 14:41:19 -0400
commit3332949c8baae581ea70ce5c61bb2a6225100422 (patch)
tree74784e7291705b2238a21c0e647d0bee4db88a81 /tests/CommentTest.php
parentbb1b4235cd9fd91d8756740cb9c44d40b20e97dc (diff)
Make unit tests compatible with PHP 5.3 and 5.4
Diffstat (limited to 'tests/CommentTest.php')
-rw-r--r--tests/CommentTest.php50
1 files changed, 37 insertions, 13 deletions
diff --git a/tests/CommentTest.php b/tests/CommentTest.php
index 8c7cce26..46f05abc 100644
--- a/tests/CommentTest.php
+++ b/tests/CommentTest.php
@@ -69,24 +69,48 @@ class CommentTest extends Base
{
$c = new Comment($this->db, $this->event);
- $this->assertTrue($c->validateCreation(['user_id' => 1, 'task_id' => 1, 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation(['user_id' => 1, 'task_id' => 1, 'comment' => ''])[0]);
- $this->assertFalse($c->validateCreation(['user_id' => 1, 'task_id' => 'a', 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation(['user_id' => 'b', 'task_id' => 1, 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation(['user_id' => 1, 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation(['task_id' => 1, 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation(['comment' => 'bla'])[0]);
- $this->assertFalse($c->validateCreation([])[0]);
+ $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->assertFalse($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->db, $this->event);
- $this->assertTrue($c->validateModification(['id' => 1, 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateModification(['id' => 1, 'comment' => ''])[0]);
- $this->assertFalse($c->validateModification(['comment' => 'bla'])[0]);
- $this->assertFalse($c->validateModification(['id' => 'b', 'comment' => 'bla'])[0]);
- $this->assertFalse($c->validateModification([])[0]);
+ $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]);
}
}