Rename all models

This commit is contained in:
Frederic Guillot
2016-05-28 19:48:22 -04:00
parent 936376ffe7
commit 14713b0ec7
411 changed files with 4145 additions and 4156 deletions

View File

@@ -2,17 +2,17 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Model\TaskCreation;
use Kanboard\Model\Project;
use Kanboard\Model\Task;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskModel;
use Kanboard\Analytic\AverageLeadCycleTimeAnalytic;
class AverageLeadCycleTimeAnalyticTest extends Base
{
public function testBuild()
{
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container);
$now = time();
@@ -26,19 +26,19 @@ class AverageLeadCycleTimeAnalyticTest extends Base
$this->assertEquals(5, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
// LT=3600 CT=1800
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600, 'date_started' => $now + 1800));
// LT=1800 CT=900
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800, 'date_started' => $now + 900));
// LT=3600 CT=0
$this->container['db']->table(Task::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 3)->update(array('date_completed' => $now + 3600));
// LT=2*3600 CT=0
$this->container['db']->table(Task::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 4)->update(array('date_completed' => $now + 2 * 3600));
// CT=0
$this->container['db']->table(Task::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 5)->update(array('date_started' => $now + 900));
$stats = $averageLeadCycleTimeAnalytic->build(1);
@@ -51,7 +51,7 @@ class AverageLeadCycleTimeAnalyticTest extends Base
public function testBuildWithNoTasks()
{
$projectModel = new Project($this->container);
$projectModel = new ProjectModel($this->container);
$averageLeadCycleTimeAnalytic = new AverageLeadCycleTimeAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));

View File

@@ -2,19 +2,19 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Model\TaskCreation;
use Kanboard\Model\Project;
use Kanboard\Model\Transition;
use Kanboard\Model\Task;
use Kanboard\Model\TaskFinder;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TransitionModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Analytic\AverageTimeSpentColumnAnalytic;
class AverageTimeSpentColumnAnalyticTest extends Base
{
public function testAverageWithNoTransitions()
{
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -24,8 +24,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base
$now = time();
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
$stats = $averageLeadCycleTimeAnalytic->build(1);
@@ -52,10 +52,10 @@ class AverageTimeSpentColumnAnalyticTest extends Base
public function testAverageWithTransitions()
{
$transitionModel = new Transition($this->container);
$taskFinderModel = new TaskFinder($this->container);
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$transitionModel = new TransitionModel($this->container);
$taskFinderModel = new TaskFinderModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -64,8 +64,8 @@ class AverageTimeSpentColumnAnalyticTest extends Base
$this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$now = time();
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
$this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600));
$this->container['db']->table(TaskModel::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800));
foreach (array(1, 2) as $task_id) {
$task = $taskFinderModel->getById($task_id);

View File

@@ -2,16 +2,16 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Model\TaskCreation;
use Kanboard\Model\Project;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Analytic\EstimatedTimeComparisonAnalytic;
class EstimatedTimeComparisonAnalyticTest extends Base
{
public function testBuild()
{
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -41,8 +41,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base
public function testBuildWithNoClosedTask()
{
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -70,8 +70,8 @@ class EstimatedTimeComparisonAnalyticTest extends Base
public function testBuildWithOnlyClosedTask()
{
$taskCreationModel = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$estimatedTimeComparisonAnalytic = new EstimatedTimeComparisonAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));

View File

@@ -2,15 +2,15 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Model\TaskCreation;
use Kanboard\Model\Project;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Analytic\TaskDistributionAnalytic;
class TaskDistributionAnalyticTest extends Base
{
public function testBuild()
{
$projectModel = new Project($this->container);
$projectModel = new ProjectModel($this->container);
$taskDistributionModel = new TaskDistributionAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -49,7 +49,7 @@ class TaskDistributionAnalyticTest extends Base
private function createTasks($column_id, $nb_active, $nb_inactive)
{
$taskCreationModel = new TaskCreation($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
for ($i = 0; $i < $nb_active; $i++) {
$this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => $column_id, 'is_active' => 1)));

View File

@@ -2,10 +2,10 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Model\TaskCreation;
use Kanboard\Model\Project;
use Kanboard\Model\ProjectUserRole;
use Kanboard\Model\User;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\ProjectUserRoleModel;
use Kanboard\Model\UserModel;
use Kanboard\Analytic\UserDistributionAnalytic;
use Kanboard\Core\Security\Role;
@@ -13,9 +13,9 @@ class UserDistributionAnalyticTest extends Base
{
public function testBuild()
{
$projectModel = new Project($this->container);
$projectUserRoleModel = new ProjectUserRole($this->container);
$userModel = new User($this->container);
$projectModel = new ProjectModel($this->container);
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
$userModel = new UserModel($this->container);
$userDistributionModel = new UserDistributionAnalytic($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
@@ -70,7 +70,7 @@ class UserDistributionAnalyticTest extends Base
private function createTasks($user_id, $nb_active, $nb_inactive)
{
$taskCreationModel = new TaskCreation($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
for ($i = 0; $i < $nb_active; $i++) {
$this->assertNotFalse($taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => $user_id, 'is_active' => 1)));