diff options
Diffstat (limited to 'tests/units/CommentTest.php')
-rw-r--r-- | tests/units/CommentTest.php | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/tests/units/CommentTest.php b/tests/units/CommentTest.php index 31c46996..36ff1352 100644 --- a/tests/units/CommentTest.php +++ b/tests/units/CommentTest.php @@ -3,6 +3,7 @@ require_once __DIR__.'/Base.php'; use Model\Task; +use Model\TaskCreation; use Model\Project; use Model\Comment; @@ -10,13 +11,13 @@ class CommentTest extends Base { public function testCreate() { - $c = new Comment($this->registry); - $t = new Task($this->registry); - $p = new Project($this->registry); + $c = new Comment($this->container); + $tc = new TaskCreation($this->container); + $p = new Project($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); - $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); - $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1))); + $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))); $comment = $c->getById(1); @@ -30,15 +31,15 @@ class CommentTest extends Base public function testGetAll() { - $c = new Comment($this->registry); - $t = new Task($this->registry); - $p = new Project($this->registry); + $c = new Comment($this->container); + $tc = new TaskCreation($this->container); + $p = new Project($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); - $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); - $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1))); - $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c2', 'user_id' => 1))); - $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c3', 'user_id' => 1))); + $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' => 'c1', 'user_id' => 1))); + $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c2', 'user_id' => 1))); + $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c3', 'user_id' => 1))); $comments = $c->getAll(1); @@ -53,13 +54,13 @@ class CommentTest extends Base public function testUpdate() { - $c = new Comment($this->registry); - $t = new Task($this->registry); - $p = new Project($this->registry); + $c = new Comment($this->container); + $tc = new TaskCreation($this->container); + $p = new Project($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); - $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); - $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1))); + $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' => 'c1', 'user_id' => 1))); $this->assertTrue($c->update(array('id' => 1, 'comment' => 'bla'))); $comment = $c->getById(1); @@ -69,12 +70,12 @@ class CommentTest extends Base public function validateRemove() { - $c = new Comment($this->registry); - $t = new Task($this->registry); - $p = new Project($this->registry); + $c = new Comment($this->container); + $tc = new TaskCreation($this->container); + $p = new Project($this->container); $this->assertEquals(1, $p->create(array('name' => 'test1'))); - $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); + $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1))); $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1))); $this->assertTrue($c->remove(1)); @@ -84,7 +85,7 @@ class CommentTest extends Base public function testValidateCreation() { - $c = new Comment($this->registry); + $c = new Comment($this->container); $result = $c->validateCreation(array('user_id' => 1, 'task_id' => 1, 'comment' => 'bla')); $this->assertTrue($result[0]); @@ -113,7 +114,7 @@ class CommentTest extends Base public function testValidateModification() { - $c = new Comment($this->registry); + $c = new Comment($this->container); $result = $c->validateModification(array('id' => 1, 'comment' => 'bla')); $this->assertTrue($result[0]); |