summaryrefslogtreecommitdiff
path: root/tests/units/Helper
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 19:48:22 -0400
commit14713b0ec7ed93ca45578da069ad4e19a7d8addf (patch)
tree79972d53f6091a1ddb17f64a6a05a5523f5d5168 /tests/units/Helper
parent936376ffe74c583d3cb819e98f53a85137fdf8bc (diff)
Rename all models
Diffstat (limited to 'tests/units/Helper')
-rw-r--r--tests/units/Helper/AssetHelperTest.php4
-rw-r--r--tests/units/Helper/ProjectActivityHelperTest.php50
-rw-r--r--tests/units/Helper/TextHelperTest.php8
-rw-r--r--tests/units/Helper/UrlHelperTest.php4
-rw-r--r--tests/units/Helper/UserHelperTest.php43
5 files changed, 54 insertions, 55 deletions
diff --git a/tests/units/Helper/AssetHelperTest.php b/tests/units/Helper/AssetHelperTest.php
index 6ef5accd..da780c4b 100644
--- a/tests/units/Helper/AssetHelperTest.php
+++ b/tests/units/Helper/AssetHelperTest.php
@@ -3,14 +3,14 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Helper\AssetHelper;
-use Kanboard\Model\Config;
+use Kanboard\Model\ConfigModel;
class AssetHelperTest extends Base
{
public function testCustomCss()
{
$h = new AssetHelper($this->container);
- $c = new Config($this->container);
+ $c = new ConfigModel($this->container);
$this->assertEmpty($h->customCss());
diff --git a/tests/units/Helper/ProjectActivityHelperTest.php b/tests/units/Helper/ProjectActivityHelperTest.php
index 88b2d352..1ad95699 100644
--- a/tests/units/Helper/ProjectActivityHelperTest.php
+++ b/tests/units/Helper/ProjectActivityHelperTest.php
@@ -1,11 +1,11 @@
<?php
use Kanboard\Helper\ProjectActivityHelper;
-use Kanboard\Model\Project;
-use Kanboard\Model\ProjectActivity;
-use Kanboard\Model\Task;
-use Kanboard\Model\TaskCreation;
-use Kanboard\Model\TaskFinder;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Model\ProjectActivityModel;
+use Kanboard\Model\TaskModel;
+use Kanboard\Model\TaskCreationModel;
+use Kanboard\Model\TaskFinderModel;
require_once __DIR__.'/../Base.php';
@@ -13,10 +13,10 @@ class ProjectActivityHelperTest extends Base
{
public function testGetProjectEvents()
{
- $taskFinder = new TaskFinder($this->container);
- $taskCreation = new TaskCreation($this->container);
- $projectModel = new Project($this->container);
- $projectActivityModel = new ProjectActivity($this->container);
+ $taskFinder = new TaskFinderModel($this->container);
+ $taskCreation = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $projectActivityModel = new ProjectActivityModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
@@ -24,9 +24,9 @@ class ProjectActivityHelperTest extends Base
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
$helper = new ProjectActivityHelper($this->container);
$events = $helper->getProjectEvents(1);
@@ -41,10 +41,10 @@ class ProjectActivityHelperTest extends Base
public function testGetProjectsEvents()
{
- $taskFinder = new TaskFinder($this->container);
- $taskCreation = new TaskCreation($this->container);
- $projectModel = new Project($this->container);
- $projectActivityModel = new ProjectActivity($this->container);
+ $taskFinder = new TaskFinderModel($this->container);
+ $taskCreation = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $projectActivityModel = new ProjectActivityModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'P2')));
@@ -54,9 +54,9 @@ class ProjectActivityHelperTest extends Base
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 2)));
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test', 'project_id' => 3)));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
- $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
- $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
+ $this->assertNotFalse($projectActivityModel->createEvent(2, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
+ $this->assertNotFalse($projectActivityModel->createEvent(3, 3, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(3))));
$helper = new ProjectActivityHelper($this->container);
$events = $helper->getProjectsEvents(array(1, 2));
@@ -71,18 +71,18 @@ class ProjectActivityHelperTest extends Base
public function testGetTaskEvents()
{
- $taskFinder = new TaskFinder($this->container);
- $taskCreation = new TaskCreation($this->container);
- $projectModel = new Project($this->container);
- $projectActivityModel = new ProjectActivity($this->container);
+ $taskFinder = new TaskFinderModel($this->container);
+ $taskCreation = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $projectActivityModel = new ProjectActivityModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test', 'project_id' => 1)));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
- $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, Task::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 1, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(1))));
+ $this->assertNotFalse($projectActivityModel->createEvent(1, 2, 1, TaskModel::EVENT_CREATE, array('task' => $taskFinder->getById(2))));
$helper = new ProjectActivityHelper($this->container);
$events = $helper->getTaskEvents(1);
diff --git a/tests/units/Helper/TextHelperTest.php b/tests/units/Helper/TextHelperTest.php
index 8f596541..c9447abb 100644
--- a/tests/units/Helper/TextHelperTest.php
+++ b/tests/units/Helper/TextHelperTest.php
@@ -3,16 +3,16 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Helper\TextHelper;
-use Kanboard\Model\Project;
-use Kanboard\Model\TaskCreation;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Model\TaskCreationModel;
class TextHelperTest extends Base
{
public function testMarkdownTaskLink()
{
$helper = new TextHelper($this->container);
- $projectModel = new Project($this->container);
- $taskCreationModel = new TaskCreation($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1')));
$this->assertTrue($projectModel->enablePublicAccess(1));
diff --git a/tests/units/Helper/UrlHelperTest.php b/tests/units/Helper/UrlHelperTest.php
index 34ab7604..b1f0a032 100644
--- a/tests/units/Helper/UrlHelperTest.php
+++ b/tests/units/Helper/UrlHelperTest.php
@@ -3,7 +3,7 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Helper\UrlHelper;
-use Kanboard\Model\Config;
+use Kanboard\Model\ConfigModel;
use Kanboard\Core\Http\Request;
class UrlHelperTest extends Base
@@ -115,7 +115,7 @@ class UrlHelperTest extends Base
$h = new UrlHelper($this->container);
$this->assertEquals('http://kb:1234/', $h->base());
- $c = new Config($this->container);
+ $c = new ConfigModel($this->container);
$c->save(array('application_url' => 'https://mykanboard/'));
$this->container['memoryCache']->flush();
diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php
index be563b47..c149e663 100644
--- a/tests/units/Helper/UserHelperTest.php
+++ b/tests/units/Helper/UserHelperTest.php
@@ -4,13 +4,12 @@ require_once __DIR__.'/../Base.php';
use Kanboard\Core\User\UserSession;
use Kanboard\Helper\UserHelper;
-use Kanboard\Model\Project;
-use Kanboard\Model\ProjectUserRole;
-use Kanboard\Model\TaskCreation;
-use Kanboard\Model\TaskFinder;
-use Kanboard\Model\User as UserModel;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Model\ProjectUserRoleModel;
+use Kanboard\Model\TaskCreationModel;
+use Kanboard\Model\TaskFinderModel;
use Kanboard\Core\Security\Role;
-use Kanboard\Model\User;
+use Kanboard\Model\UserModel;
class UserHelperTest extends Base
{
@@ -76,7 +75,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForAdmins()
{
$helper = new UserHelper($this->container);
- $project = new Project($this->container);
+ $project = new ProjectModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -92,7 +91,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForManagers()
{
$helper = new UserHelper($this->container);
- $project = new Project($this->container);
+ $project = new ProjectModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -108,7 +107,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForUsers()
{
$helper = new UserHelper($this->container);
- $project = new Project($this->container);
+ $project = new ProjectModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -125,8 +124,8 @@ class UserHelperTest extends Base
{
$helper = new UserHelper($this->container);
$user = new UserModel($this->container);
- $project = new Project($this->container);
- $projectUserRole = new ProjectUserRole($this->container);
+ $project = new ProjectModel($this->container);
+ $projectUserRole = new ProjectUserRoleModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -153,8 +152,8 @@ class UserHelperTest extends Base
{
$helper = new UserHelper($this->container);
$user = new UserModel($this->container);
- $project = new Project($this->container);
- $projectUserRole = new ProjectUserRole($this->container);
+ $project = new ProjectModel($this->container);
+ $projectUserRole = new ProjectUserRoleModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -181,8 +180,8 @@ class UserHelperTest extends Base
{
$helper = new UserHelper($this->container);
$user = new UserModel($this->container);
- $project = new Project($this->container);
- $projectUserRole = new ProjectUserRole($this->container);
+ $project = new ProjectModel($this->container);
+ $projectUserRole = new ProjectUserRoleModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -209,8 +208,8 @@ class UserHelperTest extends Base
{
$helper = new UserHelper($this->container);
$user = new UserModel($this->container);
- $project = new Project($this->container);
- $projectUserRole = new ProjectUserRole($this->container);
+ $project = new ProjectModel($this->container);
+ $projectUserRole = new ProjectUserRoleModel($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -235,11 +234,11 @@ class UserHelperTest extends Base
public function testCanRemoveTask()
{
- $taskCreationModel = new TaskCreation($this->container);
- $taskFinderModel = new TaskFinder($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
$helper = new UserHelper($this->container);
- $projectModel = new Project($this->container);
- $userModel = new User($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $userModel = new UserModel($this->container);
$userSessionModel = new UserSession($this->container);
$this->assertNotFalse($userModel->create(array('username' => 'toto', 'password' => '123456')));
@@ -278,7 +277,7 @@ class UserHelperTest extends Base
$this->assertTrue($helper->canRemoveTask($task));
// User #2 can remove his own TaskViewController
- $user = $userModel->getbyId(2);
+ $user = $userModel->getById(2);
$this->assertNotEmpty($user);
$userSessionModel->initialize($user);