summaryrefslogtreecommitdiff
path: root/tests/units/CommentTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-20 17:53:49 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-20 17:53:49 -0400
commit22b26d0b4d68f0492275ec93eb4df1a975a8fc80 (patch)
treea588fd826ce48ea6c7ce6f3da3259f8ea6204726 /tests/units/CommentTest.php
parentb6b733b22f9e9f38786166c1274b135a99bce02a (diff)
Change comments table structure (drop foreign key on user_id)
Diffstat (limited to 'tests/units/CommentTest.php')
-rw-r--r--tests/units/CommentTest.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/units/CommentTest.php b/tests/units/CommentTest.php
index 36ff1352..295ac60e 100644
--- a/tests/units/CommentTest.php
+++ b/tests/units/CommentTest.php
@@ -17,16 +17,24 @@ class CommentTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test1')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
- $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1)));
+ $this->assertEquals(1, $c->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1)));
+ $this->assertEquals(2, $c->create(array('task_id' => 1, 'comment' => 'bla bla')));
$comment = $c->getById(1);
-
$this->assertNotEmpty($comment);
$this->assertEquals('bla bla', $comment['comment']);
$this->assertEquals(1, $comment['task_id']);
$this->assertEquals(1, $comment['user_id']);
$this->assertEquals('admin', $comment['username']);
- $this->assertNotEmpty($comment['date']);
+ $this->assertEquals(time(), $comment['date_creation'], '', 3);
+
+ $comment = $c->getById(2);
+ $this->assertNotEmpty($comment);
+ $this->assertEquals('bla bla', $comment['comment']);
+ $this->assertEquals(1, $comment['task_id']);
+ $this->assertEquals(0, $comment['user_id']);
+ $this->assertEquals('', $comment['username']);
+ $this->assertEquals(time(), $comment['date_creation'], '', 3);
}
public function testGetAll()
@@ -103,7 +111,7 @@ class CommentTest extends Base
$this->assertFalse($result[0]);
$result = $c->validateCreation(array('task_id' => 1, 'comment' => 'bla'));
- $this->assertFalse($result[0]);
+ $this->assertTrue($result[0]);
$result = $c->validateCreation(array('comment' => 'bla'));
$this->assertFalse($result[0]);