Add configurable task priority
This commit is contained in:
32
tests/units/Helper/TaskHelperTest.php
Normal file
32
tests/units/Helper/TaskHelperTest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/../Base.php';
|
||||
|
||||
use Kanboard\Helper\Task;
|
||||
|
||||
class TaskHelperTest extends Base
|
||||
{
|
||||
public function testSelectPriority()
|
||||
{
|
||||
$helper = new Task($this->container);
|
||||
$this->assertNotEmpty($helper->selectPriority(array('priority_end' => '3', 'priority_start' => '1', 'priority_default' => '2'), array()));
|
||||
$this->assertEmpty($helper->selectPriority(array('priority_end' => '3', 'priority_start' => '3', 'priority_default' => '2'), array()));
|
||||
}
|
||||
|
||||
public function testFormatPriority()
|
||||
{
|
||||
$helper = new Task($this->container);
|
||||
|
||||
$this->assertEquals(
|
||||
'<span class="task-board-priority" title="Task priority">P2</span>',
|
||||
$helper->formatPriority(array('priority_end' => '3', 'priority_start' => '1', 'priority_default' => '2'), array('priority' => 2))
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'<span class="task-board-priority" title="Task priority">-P6</span>',
|
||||
$helper->formatPriority(array('priority_end' => '3', 'priority_start' => '1', 'priority_default' => '2'), array('priority' => -6))
|
||||
);
|
||||
|
||||
$this->assertEmpty($helper->formatPriority(array('priority_end' => '3', 'priority_start' => '3', 'priority_default' => '2'), array()));
|
||||
}
|
||||
}
|
||||
@@ -305,4 +305,24 @@ class ProjectTest extends Base
|
||||
$this->assertEquals('', $project['owner_username']);
|
||||
$this->assertEquals(0, $project['owner_id']);
|
||||
}
|
||||
|
||||
public function testPriority()
|
||||
{
|
||||
$projectModel = new Project($this->container);
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'My project 2')));
|
||||
|
||||
$project = $projectModel->getById(1);
|
||||
$this->assertNotEmpty($project);
|
||||
$this->assertEquals(0, $project['priority_default']);
|
||||
$this->assertEquals(0, $project['priority_start']);
|
||||
$this->assertEquals(3, $project['priority_end']);
|
||||
|
||||
$this->assertTrue($projectModel->update(array('id' => 1, 'priority_start' => 2, 'priority_end' => 5, 'priority_default' => 4)));
|
||||
|
||||
$project = $projectModel->getById(1);
|
||||
$this->assertNotEmpty($project);
|
||||
$this->assertEquals(4, $project['priority_default']);
|
||||
$this->assertEquals(2, $project['priority_start']);
|
||||
$this->assertEquals(5, $project['priority_end']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user