Change comments table structure (drop foreign key on user_id)

This commit is contained in:
Frederic Guillot
2015-06-20 17:53:49 -04:00
parent b6b733b22f
commit 22b26d0b4d
8 changed files with 96 additions and 14 deletions

View File

@@ -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]);