\ No newline at end of file
diff --git a/app/Template/config/webhook.php b/app/Template/config/webhook.php
index f1a98f8b7..bcf957871 100644
--- a/app/Template/config/webhook.php
+++ b/app/Template/config/webhook.php
@@ -22,7 +22,7 @@
\ No newline at end of file
diff --git a/app/Template/event/comment_update.php b/app/Template/event/comment_update.php
index 0cb10bf60..93f24d8a6 100644
--- a/app/Template/event/comment_update.php
+++ b/app/Template/event/comment_update.php
@@ -2,10 +2,10 @@
= e('%s updated a comment on the task %s',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
) ?>
\ No newline at end of file
diff --git a/app/Template/event/subtask_create.php b/app/Template/event/subtask_create.php
index ca23aa9c4..532783d5a 100644
--- a/app/Template/event/subtask_create.php
+++ b/app/Template/event/subtask_create.php
@@ -2,16 +2,16 @@
= e('%s created a subtask for the task %s',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
) ?>
\ No newline at end of file
diff --git a/app/Template/event/task_close.php b/app/Template/event/task_close.php
index 3d8670a60..361458d38 100644
--- a/app/Template/event/task_close.php
+++ b/app/Template/event/task_close.php
@@ -2,10 +2,10 @@
\ No newline at end of file
diff --git a/app/Template/event/task_create.php b/app/Template/event/task_create.php
index 773f401cd..655bf8f31 100644
--- a/app/Template/event/task_create.php
+++ b/app/Template/event/task_create.php
@@ -2,10 +2,10 @@
\ No newline at end of file
diff --git a/app/Template/event/task_file_create.php b/app/Template/event/task_file_create.php
index 1a36bc8f1..61bf3d61f 100644
--- a/app/Template/event/task_file_create.php
+++ b/app/Template/event/task_file_create.php
@@ -2,10 +2,10 @@
= e('%s attached a new file to the task %s',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
) ?>
\ No newline at end of file
diff --git a/app/Template/event/task_move_column.php b/app/Template/event/task_move_column.php
index ca482e465..904c956cc 100644
--- a/app/Template/event/task_move_column.php
+++ b/app/Template/event/task_move_column.php
@@ -2,11 +2,11 @@
= e('%s moved the task %s to the column "%s"',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
- $this->e($task['column_title'])
+ $this->text->e($task['column_title'])
) ?>
\ No newline at end of file
diff --git a/app/Template/event/task_move_position.php b/app/Template/event/task_move_position.php
index dcdd3e1bc..6580bb79b 100644
--- a/app/Template/event/task_move_position.php
+++ b/app/Template/event/task_move_position.php
@@ -2,12 +2,12 @@
= e('%s moved the task %s to the position #%d in the column "%s"',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
$task['position'],
- $this->e($task['column_title'])
+ $this->text->e($task['column_title'])
) ?>
\ No newline at end of file
diff --git a/app/Template/event/task_move_swimlane.php b/app/Template/event/task_move_swimlane.php
index ca440dbf9..9ffa554c3 100644
--- a/app/Template/event/task_move_swimlane.php
+++ b/app/Template/event/task_move_swimlane.php
@@ -3,17 +3,17 @@
= e('%s moved the task %s to the first swimlane',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
) ?>
= e('%s moved the task %s to the swimlane "%s"',
- $this->e($author),
+ $this->text->e($author),
$this->url->link(t('#%d', $task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
- $this->e($task['swimlane_name'])
+ $this->text->e($task['swimlane_name'])
) ?>
\ No newline at end of file
diff --git a/app/Template/event/task_open.php b/app/Template/event/task_open.php
index 11fec64b5..9db2e3c97 100644
--- a/app/Template/event/task_open.php
+++ b/app/Template/event/task_open.php
@@ -2,10 +2,10 @@
\ No newline at end of file
diff --git a/app/Template/event/task_update.php b/app/Template/event/task_update.php
index e8254bcb8..72d704956 100644
--- a/app/Template/event/task_update.php
+++ b/app/Template/event/task_update.php
@@ -2,12 +2,12 @@
@@ -6,14 +6,14 @@
= t('The task have been moved to the first swimlane') ?>
= t('The task have been moved to another swimlane:') ?>
- = $this->e($task['swimlane_name']) ?>
+ = $this->text->e($task['swimlane_name']) ?>
= t('Column on the board:') ?>
- = $this->e($task['column_title']) ?>
+ = $this->text->e($task['column_title']) ?>
- = t('Do you really want to remove this file: "%s"?', $this->e($file['name'])) ?>
+ = t('Do you really want to remove this file: "%s"?', $this->text->e($file['name'])) ?>
- = t('Do you really want to remove this task: "%s"?', $this->e($task['title'])) ?>
+ = t('Do you really want to remove this task: "%s"?', $this->text->e($task['title'])) ?>
\ No newline at end of file
diff --git a/app/Template/task/transitions.php b/app/Template/task/transitions.php
index d79c2fd92..57f1e0ffa 100644
--- a/app/Template/task/transitions.php
+++ b/app/Template/task/transitions.php
@@ -16,9 +16,9 @@
- = t('Do you really want to remove this file: "%s"?', $this->e($file['name'])) ?>
+ = t('Do you really want to remove this file: "%s"?', $this->text->e($file['name'])) ?>
- = t('Factor to calculate new due date: ') ?>= $this->e($task['recurrence_factor']) ?>
+ = t('Factor to calculate new due date: ') ?>= $this->text->e($task['recurrence_factor']) ?>
- = t('Timeframe to calculate new due date: ') ?>= $this->e($recurrence_timeframe_list[$task['recurrence_timeframe']]) ?>
+ = t('Timeframe to calculate new due date: ') ?>= $this->text->e($recurrence_timeframe_list[$task['recurrence_timeframe']]) ?>
- = t('Base date to calculate new due date: ') ?>= $this->e($recurrence_basedate_list[$task['recurrence_basedate']]) ?>
+ = t('Base date to calculate new due date: ') ?>= $this->text->e($recurrence_basedate_list[$task['recurrence_basedate']]) ?>
\ No newline at end of file
diff --git a/app/Template/user/sessions.php b/app/Template/user/sessions.php
index 8db02430f..d7fe895d3 100644
--- a/app/Template/user/sessions.php
+++ b/app/Template/user/sessions.php
@@ -17,8 +17,8 @@
+```
+
+Using your helper from another class:
+
+```php
+$this->helper->myHelper->doSomething();
+```
diff --git a/doc/plugins.markdown b/doc/plugins.markdown
index 555756124..e38c887fa 100644
--- a/doc/plugins.markdown
+++ b/doc/plugins.markdown
@@ -13,6 +13,7 @@ Plugin creators should specify explicitly the compatible versions of Kanboard. I
- [Override default application behaviors](plugin-overrides.markdown)
- [Add schema migrations for plugins](plugin-schema-migrations.markdown)
- [Custom routes](plugin-routes.markdown)
+- [Add helpers](plugin-helpers.markdown)
- [Add mail transports](plugin-mail-transports.markdown)
- [Add notification types](plugin-notifications.markdown)
- [Add automatic actions](plugin-automatic-actions.markdown)
diff --git a/tests/units/Base.php b/tests/units/Base.php
index eb9fc68be..6af14ba59 100644
--- a/tests/units/Base.php
+++ b/tests/units/Base.php
@@ -33,6 +33,7 @@ abstract class Base extends PHPUnit_Framework_TestCase
}
$this->container = new Pimple\Container;
+ $this->container->register(new Kanboard\ServiceProvider\HelperProvider);
$this->container->register(new Kanboard\ServiceProvider\AuthenticationProvider);
$this->container->register(new Kanboard\ServiceProvider\DatabaseProvider);
$this->container->register(new Kanboard\ServiceProvider\ClassProvider);
diff --git a/tests/units/Core/HelperTest.php b/tests/units/Core/HelperTest.php
new file mode 100644
index 000000000..b766dd968
--- /dev/null
+++ b/tests/units/Core/HelperTest.php
@@ -0,0 +1,17 @@
+container);
+ $helper->register('foobar', '\Stdclass');
+
+ $this->assertInstanceOf('Stdclass', $helper->foobar);
+ $this->assertInstanceOf('Stdclass', $helper->getHelper('foobar'));
+ }
+}
diff --git a/tests/units/Core/Http/RouterTest.php b/tests/units/Core/Http/RouterTest.php
index 0b200ab51..75a3ba4f5 100644
--- a/tests/units/Core/Http/RouterTest.php
+++ b/tests/units/Core/Http/RouterTest.php
@@ -40,21 +40,25 @@ namespace {
$this->assertEquals('userImport', $dispatcher->sanitize('userImport', 'default'));
}
- public function testGetPath()
+ public function testGetPathWithFolder()
{
- $dispatcher = new Router($this->container);
-
- $this->container['helper'] = new Helper($this->container);
+ $router = new Router($this->container);
$this->container['request'] = new Request($this->container, array('PHP_SELF' => '/index.php', 'REQUEST_URI' => '/a/b/c', 'REQUEST_METHOD' => 'GET'));
- $this->assertEquals('a/b/c', $dispatcher->getPath());
+ $this->assertEquals('a/b/c', $router->getPath());
+ }
- $this->container['helper'] = new Helper($this->container);
+ public function testGetPathWithQueryString()
+ {
+ $router = new Router($this->container);
$this->container['request'] = new Request($this->container, array('PHP_SELF' => '/index.php', 'REQUEST_URI' => '/a/b/something?test=a', 'QUERY_STRING' => 'test=a', 'REQUEST_METHOD' => 'GET'));
- $this->assertEquals('a/b/something', $dispatcher->getPath());
+ $this->assertEquals('a/b/something', $router->getPath());
+ }
- $this->container['helper'] = new Helper($this->container);
+ public function testGetPathWithSubFolderAndQueryString()
+ {
+ $router = new Router($this->container);
$this->container['request'] = new Request($this->container, array('PHP_SELF' => '/a/index.php', 'REQUEST_URI' => '/a/b/something?test=a', 'QUERY_STRING' => 'test=a', 'REQUEST_METHOD' => 'GET'));
- $this->assertEquals('b/something', $dispatcher->getPath());
+ $this->assertEquals('b/something', $router->getPath());
}
public function testDispatcherWithControllerNotFound()
diff --git a/tests/units/Core/TemplateTest.php b/tests/units/Core/TemplateTest.php
index 6e5ae00de..bd476c51a 100644
--- a/tests/units/Core/TemplateTest.php
+++ b/tests/units/Core/TemplateTest.php
@@ -8,7 +8,7 @@ class TemplateTest extends Base
{
public function testGetTemplateFile()
{
- $t = new Template($this->container);
+ $t = new Template($this->container['helper']);
$this->assertStringEndsWith(
'app'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.'a'.DIRECTORY_SEPARATOR.'b.php',
$t->getTemplateFile('a'.DIRECTORY_SEPARATOR.'b')
@@ -17,7 +17,7 @@ class TemplateTest extends Base
public function testGetPluginTemplateFile()
{
- $t = new Template($this->container);
+ $t = new Template($this->container['helper']);
$this->assertStringEndsWith(
'app'.DIRECTORY_SEPARATOR.'Core'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'Myplugin'.DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.'a'.DIRECTORY_SEPARATOR.'b.php',
$t->getTemplateFile('myplugin:a'.DIRECTORY_SEPARATOR.'b')
@@ -26,7 +26,7 @@ class TemplateTest extends Base
public function testGetOverridedTemplateFile()
{
- $t = new Template($this->container);
+ $t = new Template($this->container['helper']);
$t->setTemplateOverride('a'.DIRECTORY_SEPARATOR.'b', 'myplugin:c');
$this->assertStringEndsWith(
diff --git a/tests/units/Helper/AppHelperTest.php b/tests/units/Helper/AppHelperTest.php
index 4fd486f04..dee0750e5 100644
--- a/tests/units/Helper/AppHelperTest.php
+++ b/tests/units/Helper/AppHelperTest.php
@@ -3,25 +3,25 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Core\Session\FlashMessage;
-use Kanboard\Helper\App;
+use Kanboard\Helper\AppHelper;
class AppHelperTest extends Base
{
public function testJsLang()
{
- $h = new App($this->container);
+ $h = new AppHelper($this->container);
$this->assertEquals('en', $h->jsLang());
}
public function testTimezone()
{
- $h = new App($this->container);
+ $h = new AppHelper($this->container);
$this->assertEquals('UTC', $h->getTimezone());
}
public function testFlashMessage()
{
- $h = new App($this->container);
+ $h = new AppHelper($this->container);
$f = new FlashMessage($this->container);
$this->assertEmpty($h->flashMessage());
diff --git a/tests/units/Helper/AssetHelperTest.php b/tests/units/Helper/AssetHelperTest.php
index 64fcd569e..6ef5accd4 100644
--- a/tests/units/Helper/AssetHelperTest.php
+++ b/tests/units/Helper/AssetHelperTest.php
@@ -2,14 +2,14 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Asset;
+use Kanboard\Helper\AssetHelper;
use Kanboard\Model\Config;
class AssetHelperTest extends Base
{
public function testCustomCss()
{
- $h = new Asset($this->container);
+ $h = new AssetHelper($this->container);
$c = new Config($this->container);
$this->assertEmpty($h->customCss());
diff --git a/tests/units/Helper/DatetimeHelperTest.php b/tests/units/Helper/DatetimeHelperTest.php
index f27a2eb99..19b1b7045 100644
--- a/tests/units/Helper/DatetimeHelperTest.php
+++ b/tests/units/Helper/DatetimeHelperTest.php
@@ -2,19 +2,19 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Dt;
+use Kanboard\Helper\DateHelper;
class DatetimeHelperTest extends Base
{
public function testGetTime()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$this->assertEquals('17:25', $helper->time(1422206700));
}
public function testGetDate()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$this->assertEquals('01/25/2015', $helper->date(1422206700));
$this->assertEquals('01/25/2015', $helper->date('2015-01-25'));
$this->assertEquals('', $helper->date('0'));
@@ -24,13 +24,13 @@ class DatetimeHelperTest extends Base
public function testGetDatetime()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$this->assertEquals('01/25/2015 17:25', $helper->datetime(1422206700));
}
public function testAge()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$this->assertEquals('<15m', $helper->age(0, 30));
$this->assertEquals('<30m', $helper->age(0, 1000));
@@ -42,7 +42,7 @@ class DatetimeHelperTest extends Base
public function testGetDayHours()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$slots = $helper->getDayHours();
@@ -58,7 +58,7 @@ class DatetimeHelperTest extends Base
public function testGetWeekDays()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$slots = $helper->getWeekDays();
@@ -70,7 +70,7 @@ class DatetimeHelperTest extends Base
public function testGetWeekDay()
{
- $helper = new Dt($this->container);
+ $helper = new DateHelper($this->container);
$this->assertEquals('Monday', $helper->getWeekDay(1));
$this->assertEquals('Sunday', $helper->getWeekDay(7));
diff --git a/tests/units/Helper/FileHelperText.php b/tests/units/Helper/FileHelperText.php
index 6a1b78a42..215b024bb 100644
--- a/tests/units/Helper/FileHelperText.php
+++ b/tests/units/Helper/FileHelperText.php
@@ -2,20 +2,20 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\File;
+use Kanboard\Helper\FileHelper;
class FileHelperTest extends Base
{
public function testIcon()
{
- $helper = new File($this->container);
+ $helper = new FileHelper($this->container);
$this->assertEquals('fa-file-image-o', $helper->icon('test.png'));
$this->assertEquals('fa-file-o', $helper->icon('test'));
}
public function testGetMimeType()
{
- $helper = new File($this->container);
+ $helper = new FileHelper($this->container);
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.JPG'));
$this->assertEquals('image/jpeg', $helper->getImageMimeType('My File.jpeg'));
@@ -27,7 +27,7 @@ class FileHelperTest extends Base
public function testGetPreviewType()
{
- $helper = new File($this->container);
+ $helper = new FileHelper($this->container);
$this->assertEquals('text', $helper->getPreviewType('test.txt'));
$this->assertEquals('markdown', $helper->getPreviewType('test.markdown'));
$this->assertEquals('md', $helper->getPreviewType('test.md'));
diff --git a/tests/units/Helper/HookHelperTest.php b/tests/units/Helper/HookHelperTest.php
index aec4a771d..6e03acd1d 100644
--- a/tests/units/Helper/HookHelperTest.php
+++ b/tests/units/Helper/HookHelperTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Hook;
+use Kanboard\Helper\HookHelper;
class HookHelperTest extends Base
{
@@ -10,7 +10,7 @@ class HookHelperTest extends Base
{
$this->container['template'] = $this
->getMockBuilder('\Kanboard\Core\Template')
- ->setConstructorArgs(array($this->container))
+ ->setConstructorArgs(array($this->container['helper']))
->setMethods(array('render'))
->getMock();
@@ -32,7 +32,7 @@ class HookHelperTest extends Base
)
->will($this->returnValue('tpl2_content'));
- $h = new Hook($this->container);
+ $h = new HookHelper($this->container);
$h->attach('test', 'tpl1');
$h->attach('test', 'tpl2');
$this->assertEquals('tpl1_contenttpl2_content', $h->render('test'));
@@ -41,7 +41,7 @@ class HookHelperTest extends Base
public function testAssetHooks()
{
$this->container['helper']->asset = $this
- ->getMockBuilder('\Kanboard\Helper\Asset')
+ ->getMockBuilder('\Kanboard\Helper\AssetHelper')
->setConstructorArgs(array($this->container))
->setMethods(array('css', 'js'))
->getMock();
@@ -64,7 +64,7 @@ class HookHelperTest extends Base
)
->will($this->returnValue(''));
- $h = new Hook($this->container);
+ $h = new HookHelper($this->container);
$h->attach('test1', 'skin.css');
$h->attach('test2', 'skin.js');
diff --git a/tests/units/Helper/TaskHelperTest.php b/tests/units/Helper/TaskHelperTest.php
index 726188e43..454da5531 100644
--- a/tests/units/Helper/TaskHelperTest.php
+++ b/tests/units/Helper/TaskHelperTest.php
@@ -2,20 +2,20 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Task;
+use Kanboard\Helper\TaskHelper;
class TaskHelperTest extends Base
{
public function testSelectPriority()
{
- $helper = new Task($this->container);
+ $helper = new TaskHelper($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);
+ $helper = new TaskHelper($this->container);
$this->assertEquals(
'P2',
diff --git a/tests/units/Helper/TextHelperTest.php b/tests/units/Helper/TextHelperTest.php
index a4bdfa91c..d7324dfd2 100644
--- a/tests/units/Helper/TextHelperTest.php
+++ b/tests/units/Helper/TextHelperTest.php
@@ -2,13 +2,13 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Text;
+use Kanboard\Helper\TextHelper;
class TextHelperTest extends Base
{
public function testMarkdownTaskLink()
{
- $h = new Text($this->container);
+ $h = new TextHelper($this->container);
$this->assertEquals('
Test
', $h->markdown('Test'));
@@ -33,13 +33,13 @@ class TextHelperTest extends Base
public function testMarkdownUserLink()
{
- $h = new Text($this->container);
+ $h = new TextHelper($this->container);
$this->assertEquals('
', $h->markdown('Text @admin @notfound'));
}
public function testFormatBytes()
{
- $h = new Text($this->container);
+ $h = new TextHelper($this->container);
$this->assertEquals('1k', $h->bytes(1024));
$this->assertEquals('33.71k', $h->bytes(34520));
@@ -47,7 +47,7 @@ class TextHelperTest extends Base
public function testContains()
{
- $h = new Text($this->container);
+ $h = new TextHelper($this->container);
$this->assertTrue($h->contains('abc', 'b'));
$this->assertFalse($h->contains('abc', 'd'));
@@ -55,7 +55,7 @@ class TextHelperTest extends Base
public function testInList()
{
- $h = new Text($this->container);
+ $h = new TextHelper($this->container);
$this->assertEquals('?', $h->in('a', array('b' => 'c')));
$this->assertEquals('c', $h->in('b', array('b' => 'c')));
}
diff --git a/tests/units/Helper/UrlHelperTest.php b/tests/units/Helper/UrlHelperTest.php
index 15e012378..34ab7604c 100644
--- a/tests/units/Helper/UrlHelperTest.php
+++ b/tests/units/Helper/UrlHelperTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\Url;
+use Kanboard\Helper\UrlHelper;
use Kanboard\Model\Config;
use Kanboard\Core\Http\Request;
@@ -10,7 +10,7 @@ class UrlHelperTest extends Base
{
public function testPluginLink()
{
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals(
'label',
$h->link('label', 'a', 'b', array('d' => 'e', 'plugin' => 'something'), false, 'f', 'g', true)
@@ -22,7 +22,7 @@ class UrlHelperTest extends Base
$this->container['route']->enable();
$this->container['route']->addRoute('/myplugin/something/:d', 'a', 'b', 'something');
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals(
'label',
$h->link('label', 'a', 'b', array('d' => 'e', 'plugin' => 'something'), false, 'f', 'g', true)
@@ -31,7 +31,7 @@ class UrlHelperTest extends Base
public function testAppLink()
{
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals(
'label',
$h->link('label', 'a', 'b', array('d' => 'e'), false, 'f', 'g', true)
@@ -40,7 +40,7 @@ class UrlHelperTest extends Base
public function testHref()
{
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals(
'?controller=a&action=b&d=e',
$h->href('a', 'b', array('d' => 'e'))
@@ -49,7 +49,7 @@ class UrlHelperTest extends Base
public function testTo()
{
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals(
'?controller=a&action=b&d=e',
$h->to('a', 'b', array('d' => 'e'))
@@ -64,7 +64,7 @@ class UrlHelperTest extends Base
)
);
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('/kanboard/', $h->dir());
$this->container['request'] = new Request($this->container, array(
@@ -73,7 +73,7 @@ class UrlHelperTest extends Base
)
);
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('/', $h->dir());
}
@@ -87,7 +87,7 @@ class UrlHelperTest extends Base
)
);
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('http://localhost/', $h->server());
$this->container['request'] = new Request($this->container, array(
@@ -98,7 +98,7 @@ class UrlHelperTest extends Base
)
);
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('http://kb:1234/', $h->server());
}
@@ -112,14 +112,14 @@ class UrlHelperTest extends Base
)
);
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('http://kb:1234/', $h->base());
$c = new Config($this->container);
$c->save(array('application_url' => 'https://mykanboard/'));
$this->container['memoryCache']->flush();
- $h = new Url($this->container);
+ $h = new UrlHelper($this->container);
$this->assertEquals('https://mykanboard/', $c->get('application_url'));
$this->assertEquals('https://mykanboard/', $h->base());
}
diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php
index f1099faa4..7ee6e8bbc 100644
--- a/tests/units/Helper/UserHelperTest.php
+++ b/tests/units/Helper/UserHelperTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Helper\User;
+use Kanboard\Helper\UserHelper;
use Kanboard\Model\Project;
use Kanboard\Model\ProjectUserRole;
use Kanboard\Model\User as UserModel;
@@ -12,7 +12,7 @@ class UserHelperTest extends Base
{
public function testInitials()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$this->assertEquals('CN', $helper->getInitials('chuck norris'));
$this->assertEquals('A', $helper->getInitials('admin'));
@@ -20,7 +20,7 @@ class UserHelperTest extends Base
public function testGetRoleName()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$this->assertEquals('Administrator', $helper->getRoleName(Role::APP_ADMIN));
$this->assertEquals('Manager', $helper->getRoleName(Role::APP_MANAGER));
$this->assertEquals('Project Viewer', $helper->getRoleName(Role::PROJECT_VIEWER));
@@ -28,7 +28,7 @@ class UserHelperTest extends Base
public function testHasAccessForAdmins()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -42,7 +42,7 @@ class UserHelperTest extends Base
public function testHasAccessForManagers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -56,7 +56,7 @@ class UserHelperTest extends Base
public function testHasAccessForUsers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$this->container['sessionStorage']->user = array(
'id' => 2,
@@ -70,7 +70,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForAdmins()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$project = new Project($this->container);
$this->container['sessionStorage']->user = array(
@@ -86,7 +86,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForManagers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$project = new Project($this->container);
$this->container['sessionStorage']->user = array(
@@ -102,7 +102,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForUsers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$project = new Project($this->container);
$this->container['sessionStorage']->user = array(
@@ -118,7 +118,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForAppManagerAndProjectManagers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$user = new UserModel($this->container);
$project = new Project($this->container);
$projectUserRole = new ProjectUserRole($this->container);
@@ -146,7 +146,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForProjectManagers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$user = new UserModel($this->container);
$project = new Project($this->container);
$projectUserRole = new ProjectUserRole($this->container);
@@ -174,7 +174,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForProjectMembers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$user = new UserModel($this->container);
$project = new Project($this->container);
$projectUserRole = new ProjectUserRole($this->container);
@@ -202,7 +202,7 @@ class UserHelperTest extends Base
public function testHasProjectAccessForProjectViewers()
{
- $helper = new User($this->container);
+ $helper = new UserHelper($this->container);
$user = new UserModel($this->container);
$project = new Project($this->container);
$projectUserRole = new ProjectUserRole($this->container);