summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-21 22:33:57 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-21 22:33:57 -0400
commita750b8ab2a0cb715da6fd9025a7ec8375db68a4d (patch)
tree5d5cdac1830336baf93b057e93cd2c1c56f405de /tests
parent57e40671af56ae49eda467d9d5949bf9707020ee (diff)
Add categories for projects and tasks
Diffstat (limited to 'tests')
-rw-r--r--tests/Base.php2
-rw-r--r--tests/TaskTest.php14
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/Base.php b/tests/Base.php
index 4a0fe044..400643ac 100644
--- a/tests/Base.php
+++ b/tests/Base.php
@@ -36,7 +36,7 @@ abstract class Base extends PHPUnit_Framework_TestCase
'filename' => ':memory:'
));
- if ($db->schema()->check(10)) {
+ if ($db->schema()->check(16)) {
return $db;
}
else {
diff --git a/tests/TaskTest.php b/tests/TaskTest.php
index 594d0e13..2f645131 100644
--- a/tests/TaskTest.php
+++ b/tests/TaskTest.php
@@ -17,6 +17,7 @@ class TaskTest extends Base
$this->assertEquals(2, $t->create(array('title' => 'test b', 'project_id' => 1, 'column_id' => 2, 'owner_id' => 2, 'description' => 'toto et titi sont dans un bateau')));
$tasks = $t->find(array(array('column' => 'project_id', 'operator' => 'eq', 'value' => '1')));
+ $this->assertNotFalse($tasks);
$this->assertEquals(2, count($tasks));
$this->assertEquals(1, $tasks[0]['id']);
$this->assertEquals(2, $tasks[1]['id']);
@@ -101,7 +102,7 @@ class TaskTest extends Base
// We create a task and a project
$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, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1, 'category_id' => 2)));
$task = $t->getById(1);
$this->assertNotEmpty($task);
@@ -118,6 +119,7 @@ class TaskTest extends Base
$this->assertEquals(1, $task['project_id']);
$this->assertEquals(1, $task['owner_id']);
$this->assertEquals(1, $task['position']);
+ $this->assertEquals(2, $task['category_id']);
}
public function testDuplicateToAnotherProject()
@@ -130,11 +132,19 @@ class TaskTest extends Base
$this->assertEquals(2, $p->create(array('name' => 'test2')));
// We create a task
- $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
+ $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1, 'owner_id' => 1, 'category_id' => 1)));
// We duplicate our task to the 2nd project
$this->assertEquals(2, $t->duplicateToAnotherProject(1, 2));
$this->assertEquals(Task::EVENT_CREATE, $this->event->getLastTriggeredEvent());
+
+ // Check the values of the duplicated task
+ $task = $t->getById(2);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(0, $task['owner_id']);
+ $this->assertEquals(0, $task['category_id']);
+ $this->assertEquals(2, $task['project_id']);
+ $this->assertEquals('test', $task['title']);
}
public function testEvents()