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

@@ -7,10 +7,10 @@ use Kanboard\Action\TaskAssignColorColumn;
use Kanboard\Action\TaskClose;
use Kanboard\Action\TaskCloseColumn;
use Kanboard\Action\TaskUpdateStartDate;
use Kanboard\Model\Action;
use Kanboard\Model\Task;
use Kanboard\Model\Project;
use Kanboard\Model\ProjectUserRole;
use Kanboard\Model\ActionModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\ProjectUserRoleModel;
use Kanboard\Core\Security\Role;
class ActionManagerTest extends Base
@@ -79,16 +79,16 @@ class ActionManagerTest extends Base
$events = $actionManager->getCompatibleEvents('\\'.get_class($actionTaskAssignColorColumn));
$this->assertCount(2, $events);
$this->assertArrayHasKey(Task::EVENT_CREATE, $events);
$this->assertArrayHasKey(Task::EVENT_MOVE_COLUMN, $events);
$this->assertNotEmpty($events[Task::EVENT_CREATE]);
$this->assertNotEmpty($events[Task::EVENT_MOVE_COLUMN]);
$this->assertArrayHasKey(TaskModel::EVENT_CREATE, $events);
$this->assertArrayHasKey(TaskModel::EVENT_MOVE_COLUMN, $events);
$this->assertNotEmpty($events[TaskModel::EVENT_CREATE]);
$this->assertNotEmpty($events[TaskModel::EVENT_MOVE_COLUMN]);
}
public function testAttachEventsWithoutUserSession()
{
$projectModel = new Project($this->container);
$actionModel = new Action($this->container);
$projectModel = new ProjectModel($this->container);
$actionModel = new ActionModel($this->container);
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
$actionManager = new ActionManager($this->container);
$actionManager->register($actionTaskAssignColorColumn);
@@ -101,13 +101,13 @@ class ActionManagerTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' =>'test')));
$this->assertEquals(1, $actionModel->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_CREATE,
'event_name' => TaskModel::EVENT_CREATE,
'action_name' => key($actions),
'params' => array('column_id' => 1, 'color_id' => 'red'),
)));
$actionManager->attachEvents();
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_CREATE);
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_CREATE);
$this->assertCount(1, $listeners);
$this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]);
@@ -118,9 +118,9 @@ class ActionManagerTest extends Base
{
$this->container['sessionStorage']->user = array('id' => 1);
$projectModel = new Project($this->container);
$projectUserRoleModel = new ProjectUserRole($this->container);
$actionModel = new Action($this->container);
$projectModel = new ProjectModel($this->container);
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
$actionModel = new ActionModel($this->container);
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
$actionManager = new ActionManager($this->container);
$actionManager->register($actionTaskAssignColorColumn);
@@ -134,21 +134,21 @@ class ActionManagerTest extends Base
$this->assertEquals(1, $actionModel->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_CREATE,
'event_name' => TaskModel::EVENT_CREATE,
'action_name' => key($actions),
'params' => array('column_id' => 1, 'color_id' => 'red'),
)));
$this->assertEquals(2, $actionModel->create(array(
'project_id' => 2,
'event_name' => Task::EVENT_MOVE_COLUMN,
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
'action_name' => key($actions),
'params' => array('column_id' => 1, 'color_id' => 'red'),
)));
$actionManager->attachEvents();
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN);
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN);
$this->assertCount(1, $listeners);
$this->assertInstanceOf(get_class($actionTaskAssignColorColumn), $listeners[0][0]);
@@ -157,9 +157,9 @@ class ActionManagerTest extends Base
public function testThatEachListenerAreDifferentInstance()
{
$projectModel = new Project($this->container);
$projectUserRoleModel = new ProjectUserRole($this->container);
$actionModel = new Action($this->container);
$projectModel = new ProjectModel($this->container);
$projectUserRoleModel = new ProjectUserRoleModel($this->container);
$actionModel = new ActionModel($this->container);
$actionTaskAssignColorColumn = new TaskAssignColorColumn($this->container);
$actionManager = new ActionManager($this->container);
$actionManager->register($actionTaskAssignColorColumn);
@@ -169,21 +169,21 @@ class ActionManagerTest extends Base
$this->assertEquals(1, $actionModel->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_MOVE_COLUMN,
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
'action_name' => key($actions),
'params' => array('column_id' => 2, 'color_id' => 'green'),
)));
$this->assertEquals(2, $actionModel->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_MOVE_COLUMN,
'event_name' => TaskModel::EVENT_MOVE_COLUMN,
'action_name' => key($actions),
'params' => array('column_id' => 1, 'color_id' => 'red'),
)));
$actionManager->attachEvents();
$listeners = $this->container['dispatcher']->getListeners(Task::EVENT_MOVE_COLUMN);
$listeners = $this->container['dispatcher']->getListeners(TaskModel::EVENT_MOVE_COLUMN);
$this->assertCount(2, $listeners);
$this->assertFalse($listeners[0][0] === $listeners[1][0]);

View File

@@ -5,17 +5,17 @@ require_once __DIR__.'/../../Base.php';
use Kanboard\Core\Filter\LexerBuilder;
use Kanboard\Filter\TaskAssigneeFilter;
use Kanboard\Filter\TaskTitleFilter;
use Kanboard\Model\Project;
use Kanboard\Model\TaskCreation;
use Kanboard\Model\TaskFinder;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
class LexerBuilderTest extends Base
{
public function testBuilderThatReturnResult()
{
$project = new Project($this->container);
$taskCreation = new TaskCreation($this->container);
$taskFinder = new TaskFinder($this->container);
$project = new ProjectModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$taskFinder = new TaskFinderModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(1, $project->create(array('name' => 'Project')));
@@ -33,9 +33,9 @@ class LexerBuilderTest extends Base
public function testBuilderThatReturnNothing()
{
$project = new Project($this->container);
$taskCreation = new TaskCreation($this->container);
$taskFinder = new TaskFinder($this->container);
$project = new ProjectModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$taskFinder = new TaskFinderModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(1, $project->create(array('name' => 'Project')));
@@ -52,9 +52,9 @@ class LexerBuilderTest extends Base
public function testBuilderWithEmptyInput()
{
$project = new Project($this->container);
$taskCreation = new TaskCreation($this->container);
$taskFinder = new TaskFinder($this->container);
$project = new ProjectModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$taskFinder = new TaskFinderModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(1, $project->create(array('name' => 'Project')));
@@ -71,9 +71,9 @@ class LexerBuilderTest extends Base
public function testBuilderWithMultipleMatches()
{
$project = new Project($this->container);
$taskCreation = new TaskCreation($this->container);
$taskFinder = new TaskFinder($this->container);
$project = new ProjectModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$taskFinder = new TaskFinderModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(1, $project->create(array('name' => 'Project')));
@@ -91,7 +91,7 @@ class LexerBuilderTest extends Base
public function testClone()
{
$taskFinder = new TaskFinder($this->container);
$taskFinder = new TaskFinderModel($this->container);
$query = $taskFinder->getExtendedQuery();
$builder = new LexerBuilder();

View File

@@ -3,10 +3,10 @@
use Kanboard\Core\Filter\OrCriteria;
use Kanboard\Filter\TaskAssigneeFilter;
use Kanboard\Filter\TaskTitleFilter;
use Kanboard\Model\Project;
use Kanboard\Model\TaskCreation;
use Kanboard\Model\TaskFinder;
use Kanboard\Model\User;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\UserModel;
require_once __DIR__.'/../../Base.php';
@@ -14,10 +14,10 @@ class OrCriteriaTest extends Base
{
public function testWithSameFilter()
{
$taskFinder = new TaskFinder($this->container);
$taskCreation = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$userModel = new User($this->container);
$taskFinder = new TaskFinderModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$userModel = new UserModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
@@ -36,10 +36,10 @@ class OrCriteriaTest extends Base
public function testWithDifferentFilter()
{
$taskFinder = new TaskFinder($this->container);
$taskCreation = new TaskCreation($this->container);
$projectModel = new Project($this->container);
$userModel = new User($this->container);
$taskFinder = new TaskFinderModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$userModel = new UserModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));

View File

@@ -2,7 +2,7 @@
require_once __DIR__.'/../../Base.php';
use Kanboard\Model\Group;
use Kanboard\Model\GroupModel;
use Kanboard\Core\Group\GroupManager;
use Kanboard\Group\DatabaseBackendGroupProvider;
@@ -10,7 +10,7 @@ class GroupManagerTest extends Base
{
public function testFind()
{
$groupModel = new Group($this->container);
$groupModel = new GroupModel($this->container);
$groupManager = new GroupManager;
$this->assertEquals(1, $groupModel->create('Group 1'));

View File

@@ -3,15 +3,15 @@
require_once __DIR__.'/../../Base.php';
use Kanboard\Core\User\GroupSync;
use Kanboard\Model\Group;
use Kanboard\Model\GroupMember;
use Kanboard\Model\GroupModel;
use Kanboard\Model\GroupMemberModel;
class GroupSyncTest extends Base
{
public function testAddGroups()
{
$group = new Group($this->container);
$groupMember = new GroupMember($this->container);
$group = new GroupModel($this->container);
$groupMember = new GroupMemberModel($this->container);
$groupSync = new GroupSync($this->container);
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
@@ -30,8 +30,8 @@ class GroupSyncTest extends Base
public function testRemoveGroups()
{
$group = new Group($this->container);
$groupMember = new GroupMember($this->container);
$group = new GroupModel($this->container);
$groupMember = new GroupMemberModel($this->container);
$groupSync = new GroupSync($this->container);
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
@@ -50,8 +50,8 @@ class GroupSyncTest extends Base
public function testBoth()
{
$group = new Group($this->container);
$groupMember = new GroupMember($this->container);
$group = new GroupModel($this->container);
$groupMember = new GroupMemberModel($this->container);
$groupSync = new GroupSync($this->container);
$this->assertEquals(1, $group->create('My Group 1', 'externalId1'));
@@ -74,8 +74,8 @@ class GroupSyncTest extends Base
public function testThatInternalGroupsAreNotTouched()
{
$group = new Group($this->container);
$groupMember = new GroupMember($this->container);
$group = new GroupModel($this->container);
$groupMember = new GroupMemberModel($this->container);
$groupSync = new GroupSync($this->container);
$this->assertEquals(1, $group->create('My Group 1'));