Move task creation to a seperate class
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
require_once __DIR__.'/Base.php';
|
||||
|
||||
use Model\Task;
|
||||
use Model\TaskCreation;
|
||||
use Model\Project;
|
||||
use Model\Comment;
|
||||
|
||||
@@ -11,11 +12,11 @@ class CommentTest extends Base
|
||||
public function testCreate()
|
||||
{
|
||||
$c = new Comment($this->container);
|
||||
$t = new Task($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' => 'bla bla', 'user_id' => 1)));
|
||||
|
||||
$comment = $c->getById(1);
|
||||
@@ -31,11 +32,11 @@ class CommentTest extends Base
|
||||
public function testGetAll()
|
||||
{
|
||||
$c = new Comment($this->container);
|
||||
$t = new Task($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->create(array('task_id' => 1, 'comment' => 'c2', 'user_id' => 1)));
|
||||
$this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c3', 'user_id' => 1)));
|
||||
@@ -54,11 +55,11 @@ class CommentTest extends Base
|
||||
public function testUpdate()
|
||||
{
|
||||
$c = new Comment($this->container);
|
||||
$t = new Task($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->update(array('id' => 1, 'comment' => 'bla')));
|
||||
|
||||
@@ -70,11 +71,11 @@ class CommentTest extends Base
|
||||
public function validateRemove()
|
||||
{
|
||||
$c = new Comment($this->container);
|
||||
$t = new Task($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));
|
||||
|
||||
Reference in New Issue
Block a user