summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Auth/Ldap.php45
-rw-r--r--app/Controller/Board.php2
-rw-r--r--app/Controller/Doc.php2
-rw-r--r--tests/units/Action/CommentCreationTest.php (renamed from tests/units/ActionCommentCreationTest.php)4
-rw-r--r--tests/units/Action/TaskAssignColorCategoryTest.php (renamed from tests/units/ActionTaskAssignColorCategoryTest.php)4
-rw-r--r--tests/units/Action/TaskAssignColorColumnTest.php (renamed from tests/units/ActionTaskAssignColorColumnTest.php)4
-rw-r--r--tests/units/Action/TaskAssignColorLinkTest.php (renamed from tests/units/ActionTaskAssignColorLinkTest.php)4
-rw-r--r--tests/units/Action/TaskAssignColorUserTest.php (renamed from tests/units/ActionTaskAssignColorUserTest.php)4
-rw-r--r--tests/units/Action/TaskAssignCurrentUserTest.php (renamed from tests/units/ActionTaskAssignCurrentUserTest.php)4
-rw-r--r--tests/units/Action/TaskAssignSpecificUserTest.php (renamed from tests/units/ActionTaskAssignSpecificUserTest.php)4
-rw-r--r--tests/units/Action/TaskCloseTest.php (renamed from tests/units/ActionTaskCloseTest.php)4
-rw-r--r--tests/units/Action/TaskDuplicateAnotherProjectTest.php (renamed from tests/units/ActionTaskDuplicateAnotherProjectTest.php)4
-rw-r--r--tests/units/Action/TaskEmailTest.php (renamed from tests/units/ActionTaskEmailTest.php)4
-rw-r--r--tests/units/Action/TaskMoveAnotherProjectTest.php (renamed from tests/units/ActionTaskMoveAnotherProjectTest.php)4
-rw-r--r--tests/units/Action/TaskMoveColumnCategoryChangeTest.php (renamed from tests/units/ActionTaskMoveColumnCategoryChangeTest.php)4
-rw-r--r--tests/units/Action/TaskUpdateStartDateTest.php (renamed from tests/units/ActionTaskUpdateStartDateTest.php)4
-rw-r--r--tests/units/Auth/LdapTest.php122
-rw-r--r--tests/units/Base.php3
-rw-r--r--tests/units/Core/LexerTest.php (renamed from tests/units/LexerTest.php)2
-rw-r--r--tests/units/Core/OAuth2Test.php (renamed from tests/units/OAuth2Test.php)2
-rw-r--r--tests/units/Core/RouterTest.php (renamed from tests/units/RouterTest.php)2
-rw-r--r--tests/units/Core/ToolTest.php (renamed from tests/units/ToolTest.php)2
-rw-r--r--tests/units/Helper/AppHelperTest.php (renamed from tests/units/AppHelperTest.php)2
-rw-r--r--tests/units/Helper/AssetHelperTest.php (renamed from tests/units/AssetHelperTest.php)2
-rw-r--r--tests/units/Helper/DatetimeHelperTest.php (renamed from tests/units/DatetimeHelperTest.php)2
-rw-r--r--tests/units/Helper/FileHelperText.php (renamed from tests/units/FileHelperText.php)2
-rw-r--r--tests/units/Helper/TextHelperTest.php (renamed from tests/units/TextHelperTest.php)2
-rw-r--r--tests/units/Helper/UrlHelperTest.php (renamed from tests/units/UrlHelperTest.php)2
-rw-r--r--tests/units/Helper/UserHelperTest.php (renamed from tests/units/UserHelperTest.php)2
-rw-r--r--tests/units/Integration/BitbucketWebhookTest.php (renamed from tests/units/BitbucketWebhookTest.php)30
-rw-r--r--tests/units/Integration/GithubWebhookTest.php (renamed from tests/units/GithubWebhookTest.php)40
-rw-r--r--tests/units/Integration/GitlabWebhookTest.php (renamed from tests/units/GitlabWebhookTest.php)20
-rw-r--r--tests/units/Integration/MailgunTest.php (renamed from tests/units/MailgunTest.php)2
-rw-r--r--tests/units/Integration/PostmarkTest.php (renamed from tests/units/PostmarkTest.php)2
-rw-r--r--tests/units/Integration/SendgridTest.php (renamed from tests/units/SendgridTest.php)2
-rw-r--r--tests/units/Locale/LocaleTest.php (renamed from tests/units/LocaleTest.php)2
-rw-r--r--tests/units/Model/AclTest.php (renamed from tests/units/AclTest.php)2
-rw-r--r--tests/units/Model/ActionTest.php (renamed from tests/units/ActionTest.php)2
-rw-r--r--tests/units/Model/AuthenticationTest.php (renamed from tests/units/AuthenticationTest.php)2
-rw-r--r--tests/units/Model/BoardTest.php (renamed from tests/units/BoardTest.php)2
-rw-r--r--tests/units/Model/CategoryTest.php (renamed from tests/units/CategoryTest.php)2
-rw-r--r--tests/units/Model/CommentTest.php (renamed from tests/units/CommentTest.php)2
-rw-r--r--tests/units/Model/ConfigTest.php (renamed from tests/units/ConfigTest.php)2
-rw-r--r--tests/units/Model/DateParserTest.php (renamed from tests/units/DateParserTest.php)2
-rw-r--r--tests/units/Model/FileTest.php (renamed from tests/units/FileTest.php)2
-rw-r--r--tests/units/Model/HourlyRateTest.php (renamed from tests/units/HourlyRate.php)2
-rw-r--r--tests/units/Model/LinkTest.php (renamed from tests/units/LinkTest.php)2
-rw-r--r--tests/units/Model/NotificationTest.php (renamed from tests/units/NotificationTest.php)2
-rw-r--r--tests/units/Model/ProjectActivityTest.php (renamed from tests/units/ProjectActivityTest.php)2
-rw-r--r--tests/units/Model/ProjectDailyColumnStatsTest.php (renamed from tests/units/ProjectDailyColumnStatsTest.php)2
-rw-r--r--tests/units/Model/ProjectDuplicationTest.php (renamed from tests/units/ProjectDuplicationTest.php)8
-rw-r--r--tests/units/Model/ProjectPermissionTest.php (renamed from tests/units/ProjectPermissionTest.php)2
-rw-r--r--tests/units/Model/ProjectTest.php (renamed from tests/units/ProjectTest.php)2
-rw-r--r--tests/units/Model/SubtaskTest.php (renamed from tests/units/SubtaskTest.php)2
-rw-r--r--tests/units/Model/SubtaskTimeTrackingTest.php (renamed from tests/units/SubtaskTimeTrackingTest.php)2
-rw-r--r--tests/units/Model/SwimlaneTest.php (renamed from tests/units/SwimlaneTest.php)8
-rw-r--r--tests/units/Model/TaskCreationTest.php (renamed from tests/units/TaskCreationTest.php)2
-rw-r--r--tests/units/Model/TaskDuplicationTest.php (renamed from tests/units/TaskDuplicationTest.php)4
-rw-r--r--tests/units/Model/TaskExportTest.php (renamed from tests/units/TaskExportTest.php)2
-rw-r--r--tests/units/Model/TaskFilterTest.php (renamed from tests/units/TaskFilterTest.php)2
-rw-r--r--tests/units/Model/TaskFinderTest.php (renamed from tests/units/TaskFinderTest.php)2
-rw-r--r--tests/units/Model/TaskLinkTest.php (renamed from tests/units/TaskLinkTest.php)2
-rw-r--r--tests/units/Model/TaskModificationTest.php (renamed from tests/units/TaskModificationTest.php)2
-rw-r--r--tests/units/Model/TaskMovedDateSubscriberTest.php (renamed from tests/units/TaskMovedDateSubscriberTest.php)2
-rw-r--r--tests/units/Model/TaskPermissionTest.php (renamed from tests/units/TaskPermissionTest.php)2
-rw-r--r--tests/units/Model/TaskPositionTest.php (renamed from tests/units/TaskPositionTest.php)2
-rw-r--r--tests/units/Model/TaskStatusTest.php (renamed from tests/units/TaskStatusTest.php)2
-rw-r--r--tests/units/Model/TaskTest.php (renamed from tests/units/TaskTest.php)2
-rw-r--r--tests/units/Model/TimetableTest.php (renamed from tests/units/TimetableTest.php)2
-rw-r--r--tests/units/Model/UserSessionTest.php (renamed from tests/units/UserSessionTest.php)2
-rw-r--r--tests/units/Model/UserTest.php (renamed from tests/units/UserTest.php)2
-rw-r--r--tests/units/Model/WebhookTest.php (renamed from tests/units/WebhookTest.php)2
72 files changed, 281 insertions, 151 deletions
diff --git a/app/Auth/Ldap.php b/app/Auth/Ldap.php
index c1459b4e..e46d9b81 100644
--- a/app/Auth/Ldap.php
+++ b/app/Auth/Ldap.php
@@ -98,7 +98,7 @@ class Ldap extends Base
{
$ldap = $this->connect();
- if (is_resource($ldap) && $this->bind($ldap, $username, $password)) {
+ if ($ldap !== false && $this->bind($ldap, $username, $password)) {
return $this->search($ldap, $username, $password);
}
@@ -108,13 +108,14 @@ class Ldap extends Base
/**
* LDAP connection
*
- * @access private
- * @return resource $ldap LDAP connection
+ * @access public
+ * @return resource|boolean
*/
- private function connect()
+ public function connect()
{
if (! function_exists('ldap_connect')) {
- die('The PHP LDAP extension is required');
+ $this->logger->error('The PHP LDAP extension is required');
+ return false;
}
// Skip SSL certificate verification
@@ -124,8 +125,9 @@ class Ldap extends Base
$ldap = ldap_connect(LDAP_SERVER, LDAP_PORT);
- if (! is_resource($ldap)) {
- die('Unable to connect to the LDAP server: "'.LDAP_SERVER.'"');
+ if ($ldap === false) {
+ $this->logger->error('Unable to connect to the LDAP server: "'.LDAP_SERVER.'"');
+ return false;
}
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
@@ -134,7 +136,8 @@ class Ldap extends Base
ldap_set_option($ldap, LDAP_OPT_TIMELIMIT, 1);
if (LDAP_START_TLS && ! @ldap_start_tls($ldap)) {
- die('Unable to use ldap_start_tls()');
+ $this->logger->error('Unable to use ldap_start_tls()');
+ return false;
}
return $ldap;
@@ -143,21 +146,24 @@ class Ldap extends Base
/**
* LDAP bind
*
- * @access private
- * @param resource $ldap LDAP connection
- * @param string $username Username
- * @param string $password Password
+ * @access public
+ * @param resource $ldap
+ * @param string $username
+ * @param string $password
+ * @param string $ldap_type
+ * @param string $ldap_username
+ * @param string $ldap_password
* @return boolean
*/
- private function bind($ldap, $username, $password)
+ public function bind($ldap, $username, $password, $ldap_type = LDAP_BIND_TYPE, $ldap_username = LDAP_USERNAME, $ldap_password = LDAP_PASSWORD)
{
- if (LDAP_BIND_TYPE === 'user') {
- $ldap_username = sprintf(LDAP_USERNAME, $username);
+ if ($ldap_type === 'user') {
+ $ldap_username = sprintf($ldap_username, $username);
$ldap_password = $password;
}
- else if (LDAP_BIND_TYPE === 'proxy') {
- $ldap_username = LDAP_USERNAME;
- $ldap_password = LDAP_PASSWORD;
+ else if ($ldap_type === 'proxy') {
+ $ldap_username = $ldap_username;
+ $ldap_password = $ldap_password;
}
else {
$ldap_username = null;
@@ -191,13 +197,12 @@ class Ldap extends Base
$info = ldap_get_entries($ldap, $sr);
// User not found
- if (count($info) == 0 || $info['count'] == 0) {
+ if (count($info) === 0 || $info['count'] == 0) {
return false;
}
// We got our user
if (@ldap_bind($ldap, $info[0]['dn'], $password)) {
-
return array(
'username' => $username,
'name' => $this->getFromInfo($info, LDAP_ACCOUNT_FULLNAME),
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 360a705f..a552b9cf 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -327,7 +327,7 @@ class Board extends Base
*/
public function swimlane()
{
- $project = $this->getProject();
+ $this->getProject();
$swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
$this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
}
diff --git a/app/Controller/Doc.php b/app/Controller/Doc.php
index 19644b84..d9f7b5e7 100644
--- a/app/Controller/Doc.php
+++ b/app/Controller/Doc.php
@@ -16,7 +16,7 @@ class Doc extends Base
{
$url = $this->helper->url;
$data = file_get_contents($filename);
- list($title,, $content) = explode("\n", $data, 3);
+ list($title,) = explode("\n", $data, 2);
$replaceUrl = function (array $matches) use ($url) {
return '('.$url->to('doc', 'show', array('file' => str_replace('.markdown', '', $matches[1]))).')';
diff --git a/tests/units/ActionCommentCreationTest.php b/tests/units/Action/CommentCreationTest.php
index cf9e1e0a..6b5fe1ea 100644
--- a/tests/units/ActionCommentCreationTest.php
+++ b/tests/units/Action/CommentCreationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\Comment;
use Model\Project;
use Integration\GithubWebhook;
-class ActionCommentCreationTest extends Base
+class CommentCreationTest extends Base
{
public function testWithoutRequiredParams()
{
diff --git a/tests/units/ActionTaskAssignColorCategoryTest.php b/tests/units/Action/TaskAssignColorCategoryTest.php
index 3669ce46..44d23943 100644
--- a/tests/units/ActionTaskAssignColorCategoryTest.php
+++ b/tests/units/Action/TaskAssignColorCategoryTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -9,7 +9,7 @@ use Model\Project;
use Model\Category;
use Event\GenericEvent;
-class ActionTaskAssignColorCategory extends Base
+class TaskAssignColorCategory extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskAssignColorColumnTest.php b/tests/units/Action/TaskAssignColorColumnTest.php
index 363bb05c..55767327 100644
--- a/tests/units/ActionTaskAssignColorColumnTest.php
+++ b/tests/units/Action/TaskAssignColorColumnTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
-class ActionTaskAssignColorColumnTest extends Base
+class TaskAssignColorColumnTest extends Base
{
public function testColorChange()
{
diff --git a/tests/units/ActionTaskAssignColorLinkTest.php b/tests/units/Action/TaskAssignColorLinkTest.php
index b0cd269e..c78af5bb 100644
--- a/tests/units/ActionTaskAssignColorLinkTest.php
+++ b/tests/units/Action/TaskAssignColorLinkTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\TaskLinkEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\TaskLink;
use Model\Project;
-class ActionTaskAssignColorLinkTest extends Base
+class TaskAssignColorLinkTest extends Base
{
public function testExecute()
{
diff --git a/tests/units/ActionTaskAssignColorUserTest.php b/tests/units/Action/TaskAssignColorUserTest.php
index c1bf3a34..896b48fc 100644
--- a/tests/units/ActionTaskAssignColorUserTest.php
+++ b/tests/units/Action/TaskAssignColorUserTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -8,7 +8,7 @@ use Model\TaskFinder;
use Model\Project;
use Event\GenericEvent;
-class ActionTaskAssignColorUser extends Base
+class TaskAssignColorUser extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskAssignCurrentUserTest.php b/tests/units/Action/TaskAssignCurrentUserTest.php
index f32fc77c..9ea816d4 100644
--- a/tests/units/ActionTaskAssignCurrentUserTest.php
+++ b/tests/units/Action/TaskAssignCurrentUserTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Model\UserSession;
-class ActionTaskAssignCurrentUser extends Base
+class TaskAssignCurrentUser extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskAssignSpecificUserTest.php b/tests/units/Action/TaskAssignSpecificUserTest.php
index ac054ba6..ae8de177 100644
--- a/tests/units/ActionTaskAssignSpecificUserTest.php
+++ b/tests/units/Action/TaskAssignSpecificUserTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
-class ActionTaskAssignSpecificUser extends Base
+class TaskAssignSpecificUser extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskCloseTest.php b/tests/units/Action/TaskCloseTest.php
index 7f2c42de..8cee6f13 100644
--- a/tests/units/ActionTaskCloseTest.php
+++ b/tests/units/Action/TaskCloseTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Integration\GithubWebhook;
-class ActionTaskCloseTest extends Base
+class TaskCloseTest extends Base
{
public function testExecutable()
{
diff --git a/tests/units/ActionTaskDuplicateAnotherProjectTest.php b/tests/units/Action/TaskDuplicateAnotherProjectTest.php
index 10c7c36a..37eb4052 100644
--- a/tests/units/ActionTaskDuplicateAnotherProjectTest.php
+++ b/tests/units/Action/TaskDuplicateAnotherProjectTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
-class ActionTaskDuplicateAnotherProject extends Base
+class TaskDuplicateAnotherProject extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskEmailTest.php b/tests/units/Action/TaskEmailTest.php
index adc74512..d74e1af2 100644
--- a/tests/units/ActionTaskEmailTest.php
+++ b/tests/units/Action/TaskEmailTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -9,7 +9,7 @@ use Model\TaskFinder;
use Model\Project;
use Model\User;
-class ActionTaskEmailTest extends Base
+class TaskEmailTest extends Base
{
public function testNoEmail()
{
diff --git a/tests/units/ActionTaskMoveAnotherProjectTest.php b/tests/units/Action/TaskMoveAnotherProjectTest.php
index 3f0c3de6..78bc6570 100644
--- a/tests/units/ActionTaskMoveAnotherProjectTest.php
+++ b/tests/units/Action/TaskMoveAnotherProjectTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
-class ActionTaskMoveAnotherProject extends Base
+class TaskMoveAnotherProject extends Base
{
public function testBadProject()
{
diff --git a/tests/units/ActionTaskMoveColumnCategoryChangeTest.php b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php
index 0ddee786..4b7dec68 100644
--- a/tests/units/ActionTaskMoveColumnCategoryChangeTest.php
+++ b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -10,7 +10,7 @@ use Model\Project;
use Model\Category;
use Integration\GithubWebhook;
-class ActionTaskMoveColumnCategoryChangeTest extends Base
+class TaskMoveColumnCategoryChangeTest extends Base
{
public function testExecute()
{
diff --git a/tests/units/ActionTaskUpdateStartDateTest.php b/tests/units/Action/TaskUpdateStartDateTest.php
index a7df820f..14f3b5b7 100644
--- a/tests/units/ActionTaskUpdateStartDateTest.php
+++ b/tests/units/Action/TaskUpdateStartDateTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Event\GenericEvent;
use Model\Task;
@@ -8,7 +8,7 @@ use Model\TaskCreation;
use Model\TaskFinder;
use Model\Project;
-class ActionTaskUpdateStartDateTest extends Base
+class TaskUpdateStartDateTest extends Base
{
public function testExecute()
{
diff --git a/tests/units/Auth/LdapTest.php b/tests/units/Auth/LdapTest.php
new file mode 100644
index 00000000..e861be98
--- /dev/null
+++ b/tests/units/Auth/LdapTest.php
@@ -0,0 +1,122 @@
+<?php
+
+namespace Auth;
+
+require_once __DIR__.'/../Base.php';
+
+function ldap_connect($hostname, $port)
+{
+ return LdapTest::$functions->ldap_connect($hostname, $port);
+}
+
+function ldap_set_option()
+{
+}
+
+function ldap_bind($ldap, $ldap_username, $ldap_password)
+{
+ return LdapTest::$functions->ldap_bind($ldap, $ldap_username, $ldap_password);
+}
+
+class LdapTest extends \Base
+{
+ public static $functions;
+
+ public function setUp()
+ {
+ parent::setup();
+
+ self::$functions = $this
+ ->getMockBuilder('stdClass')
+ ->setMethods(array(
+ 'ldap_connect',
+ 'ldap_set_option',
+ 'ldap_bind',
+ ))
+ ->getMock();
+ }
+
+ public function tearDown()
+ {
+ parent::tearDown();
+ self::$functions = null;
+ }
+
+ public function testConnectSuccess()
+ {
+ self::$functions
+ ->expects($this->once())
+ ->method('ldap_connect')
+ ->with(
+ $this->equalTo('my_ldap_server'),
+ $this->equalTo(389)
+ )
+ ->willReturn(true);
+
+ $ldap = new Ldap($this->container);
+ $this->assertNotFalse($ldap->connect());
+ }
+
+ public function testConnectFailure()
+ {
+ self::$functions
+ ->expects($this->once())
+ ->method('ldap_connect')
+ ->with(
+ $this->equalTo('my_ldap_server'),
+ $this->equalTo(389)
+ )
+ ->willReturn(false);
+
+ $ldap = new Ldap($this->container);
+ $this->assertFalse($ldap->connect());
+ }
+
+ public function testBindAnonymous()
+ {
+ self::$functions
+ ->expects($this->once())
+ ->method('ldap_bind')
+ ->with(
+ $this->equalTo('my_ldap_connection'),
+ $this->equalTo(null),
+ $this->equalTo(null)
+ )
+ ->willReturn(true);
+
+ $ldap = new Ldap($this->container);
+ $this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'anonymous'));
+ }
+
+ public function testBindUser()
+ {
+ self::$functions
+ ->expects($this->once())
+ ->method('ldap_bind')
+ ->with(
+ $this->equalTo('my_ldap_connection'),
+ $this->equalTo('uid=my_user'),
+ $this->equalTo('my_password')
+ )
+ ->willReturn(true);
+
+ $ldap = new Ldap($this->container);
+ $this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'user', 'uid=%s', 'something'));
+ }
+
+ public function testBindProxy()
+ {
+ self::$functions
+ ->expects($this->once())
+ ->method('ldap_bind')
+ ->with(
+ $this->equalTo('my_ldap_connection'),
+ $this->equalTo('someone'),
+ $this->equalTo('something')
+ )
+ ->willReturn(true);
+
+ $ldap = new Ldap($this->container);
+ $this->assertTrue($ldap->bind('my_ldap_connection', 'my_user', 'my_password', 'proxy', 'someone', 'something'));
+ }
+}
diff --git a/tests/units/Base.php b/tests/units/Base.php
index 0a045a09..a48ae5ec 100644
--- a/tests/units/Base.php
+++ b/tests/units/Base.php
@@ -1,6 +1,9 @@
<?php
require __DIR__.'/../../vendor/autoload.php';
+
+define('LDAP_SERVER', 'my_ldap_server');
+
require __DIR__.'/../../app/constants.php';
use Symfony\Component\EventDispatcher\EventDispatcher;
diff --git a/tests/units/LexerTest.php b/tests/units/Core/LexerTest.php
index 3b15810e..044655fc 100644
--- a/tests/units/LexerTest.php
+++ b/tests/units/Core/LexerTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Lexer;
diff --git a/tests/units/OAuth2Test.php b/tests/units/Core/OAuth2Test.php
index 0275f426..a0e4b43f 100644
--- a/tests/units/OAuth2Test.php
+++ b/tests/units/Core/OAuth2Test.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\OAuth2;
diff --git a/tests/units/RouterTest.php b/tests/units/Core/RouterTest.php
index e4582121..99c49ba8 100644
--- a/tests/units/RouterTest.php
+++ b/tests/units/Core/RouterTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Router;
diff --git a/tests/units/ToolTest.php b/tests/units/Core/ToolTest.php
index 4a62fe3b..e714f506 100644
--- a/tests/units/ToolTest.php
+++ b/tests/units/Core/ToolTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Tool;
diff --git a/tests/units/AppHelperTest.php b/tests/units/Helper/AppHelperTest.php
index ad4bc151..54ccd697 100644
--- a/tests/units/AppHelperTest.php
+++ b/tests/units/Helper/AppHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Session;
use Helper\App;
diff --git a/tests/units/AssetHelperTest.php b/tests/units/Helper/AssetHelperTest.php
index 1143ce1f..ece81d04 100644
--- a/tests/units/AssetHelperTest.php
+++ b/tests/units/Helper/AssetHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\Asset;
use Model\Config;
diff --git a/tests/units/DatetimeHelperTest.php b/tests/units/Helper/DatetimeHelperTest.php
index 21d452dd..d4fc3c3d 100644
--- a/tests/units/DatetimeHelperTest.php
+++ b/tests/units/Helper/DatetimeHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\Dt;
diff --git a/tests/units/FileHelperText.php b/tests/units/Helper/FileHelperText.php
index ce04fdbd..cd5ebffd 100644
--- a/tests/units/FileHelperText.php
+++ b/tests/units/Helper/FileHelperText.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\File;
diff --git a/tests/units/TextHelperTest.php b/tests/units/Helper/TextHelperTest.php
index 95c83e57..5495cd1c 100644
--- a/tests/units/TextHelperTest.php
+++ b/tests/units/Helper/TextHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\Text;
diff --git a/tests/units/UrlHelperTest.php b/tests/units/Helper/UrlHelperTest.php
index ebfe9c99..5c2477b5 100644
--- a/tests/units/UrlHelperTest.php
+++ b/tests/units/Helper/UrlHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\Url;
use Model\Config;
diff --git a/tests/units/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php
index 9129edd9..947f606a 100644
--- a/tests/units/UserHelperTest.php
+++ b/tests/units/Helper/UserHelperTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Helper\User;
diff --git a/tests/units/BitbucketWebhookTest.php b/tests/units/Integration/BitbucketWebhookTest.php
index afc8be1d..1902f738 100644
--- a/tests/units/BitbucketWebhookTest.php
+++ b/tests/units/Integration/BitbucketWebhookTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\BitbucketWebhook;
use Model\TaskCreation;
@@ -18,7 +18,7 @@ class BitbucketWebhookTest extends Base
$tc = new TaskCreation($this->container);
$p = new Project($this->container);
$bw = new BitbucketWebhook($this->container);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_push.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_push.json'), true);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$bw->setProjectId(1);
@@ -50,7 +50,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($bw->parsePayload(
'issue:created',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_opened.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_opened.json'), true)
));
}
@@ -69,7 +69,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -91,7 +91,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -116,7 +116,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:comment_created',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_comment_created.json'), true)
));
}
@@ -135,7 +135,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_closed.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_closed.json'), true)
));
}
@@ -154,7 +154,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_closed.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_closed.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -175,7 +175,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_reopened.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_reopened.json'), true)
));
}
@@ -194,7 +194,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_reopened.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_reopened.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -215,7 +215,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_unassigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_unassigned.json'), true)
));
}
@@ -240,7 +240,7 @@ class BitbucketWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertNotEmpty($this->container['dispatcher']->getCalledListeners());
@@ -264,7 +264,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -285,7 +285,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
@@ -306,7 +306,7 @@ class BitbucketWebhookTest extends Base
$this->assertFalse($g->parsePayload(
'issue:updated',
- json_decode(file_get_contents(__DIR__.'/fixtures/bitbucket_issue_assigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/bitbucket_issue_assigned.json'), true)
));
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
diff --git a/tests/units/GithubWebhookTest.php b/tests/units/Integration/GithubWebhookTest.php
index e143cc1d..3b67ad1c 100644
--- a/tests/units/GithubWebhookTest.php
+++ b/tests/units/Integration/GithubWebhookTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\GithubWebhook;
use Model\TaskCreation;
@@ -23,7 +23,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_opened.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_opened.json'), true)
));
}
@@ -48,7 +48,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true)
));
}
@@ -60,7 +60,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -76,7 +76,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -95,7 +95,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertFalse($g->handleIssueAssigned($payload['issue']));
}
@@ -117,7 +117,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_assigned.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_assigned.json'), true);
$this->assertTrue($g->handleIssueAssigned($payload['issue']));
}
@@ -137,7 +137,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unassigned.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unassigned.json'), true)
));
}
@@ -156,7 +156,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_closed.json'), true)
));
}
@@ -168,7 +168,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_closed.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_closed.json'), true);
$this->assertFalse($g->handleIssueClosed($payload['issue']));
}
@@ -188,7 +188,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_reopened.json'), true)
));
}
@@ -200,7 +200,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_reopened.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_reopened.json'), true);
$this->assertFalse($g->handleIssueReopened($payload['issue']));
}
@@ -220,7 +220,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_labeled.json'), true)
));
}
@@ -232,7 +232,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_labeled.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_labeled.json'), true);
$this->assertFalse($g->handleIssueLabeled($payload['issue'], $payload['label']));
}
@@ -252,7 +252,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issues',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unlabeled.json'), true)
));
}
@@ -264,7 +264,7 @@ class GithubWebhookTest extends Base
$g = new GithubWebhook($this->container);
$g->setProjectId(1);
- $payload = json_decode(file_get_contents(__DIR__.'/fixtures/github_issue_unlabeled.json'), true);
+ $payload = json_decode(file_get_contents(__DIR__.'/../fixtures/github_issue_unlabeled.json'), true);
$this->assertFalse($g->handleIssueUnlabeled($payload['issue'], $payload['label']));
}
@@ -284,7 +284,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -306,7 +306,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -331,7 +331,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'issue_comment',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_comment_created.json'), true)
));
}
@@ -350,7 +350,7 @@ class GithubWebhookTest extends Base
$this->assertNotFalse($g->parsePayload(
'push',
- json_decode(file_get_contents(__DIR__.'/fixtures/github_push.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/github_push.json'), true)
));
}
diff --git a/tests/units/GitlabWebhookTest.php b/tests/units/Integration/GitlabWebhookTest.php
index a2dc0d3a..ec073fee 100644
--- a/tests/units/GitlabWebhookTest.php
+++ b/tests/units/Integration/GitlabWebhookTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\GitlabWebhook;
use Model\TaskCreation;
@@ -15,9 +15,9 @@ class GitlabWebhookTest extends Base
{
$g = new GitlabWebhook($this->container);
- $this->assertEquals(GitlabWebhook::TYPE_PUSH, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_push.json'), true)));
- $this->assertEquals(GitlabWebhook::TYPE_ISSUE, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_opened.json'), true)));
- $this->assertEquals(GitlabWebhook::TYPE_COMMENT, $g->getType(json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)));
+ $this->assertEquals(GitlabWebhook::TYPE_PUSH, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_push.json'), true)));
+ $this->assertEquals(GitlabWebhook::TYPE_ISSUE, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_opened.json'), true)));
+ $this->assertEquals(GitlabWebhook::TYPE_COMMENT, $g->getType(json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)));
$this->assertEquals('', $g->getType(array()));
}
@@ -33,7 +33,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_COMMIT, array($this, 'onCommit'));
- $event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_push.json'), true);
+ $event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_push.json'), true);
// No task
$this->assertFalse($g->handleCommit($event['commits'][0]));
@@ -57,7 +57,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_ISSUE_OPENED, array($this, 'onOpen'));
- $event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_opened.json'), true);
+ $event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_opened.json'), true);
$this->assertTrue($g->handleIssueOpened($event['object_attributes']));
$called = $this->container['dispatcher']->getCalledListeners();
@@ -76,7 +76,7 @@ class GitlabWebhookTest extends Base
$this->container['dispatcher']->addListener(GitlabWebhook::EVENT_ISSUE_CLOSED, array($this, 'onClose'));
- $event = json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_issue_closed.json'), true);
+ $event = json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_issue_closed.json'), true);
// Issue not there
$this->assertFalse($g->handleIssueClosed($event['object_attributes']));
@@ -112,7 +112,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
- json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}
@@ -133,7 +133,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
- json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}
@@ -157,7 +157,7 @@ class GitlabWebhookTest extends Base
$g->setProjectId(1);
$this->assertNotFalse($g->parsePayload(
- json_decode(file_get_contents(__DIR__.'/fixtures/gitlab_comment_created.json'), true)
+ json_decode(file_get_contents(__DIR__.'/../fixtures/gitlab_comment_created.json'), true)
));
}
diff --git a/tests/units/MailgunTest.php b/tests/units/Integration/MailgunTest.php
index ce53228e..67914b0a 100644
--- a/tests/units/MailgunTest.php
+++ b/tests/units/Integration/MailgunTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\Mailgun;
use Model\TaskCreation;
diff --git a/tests/units/PostmarkTest.php b/tests/units/Integration/PostmarkTest.php
index f3d2e55b..9115e24a 100644
--- a/tests/units/PostmarkTest.php
+++ b/tests/units/Integration/PostmarkTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\Postmark;
use Model\TaskCreation;
diff --git a/tests/units/SendgridTest.php b/tests/units/Integration/SendgridTest.php
index 1fc5d0d5..b2352076 100644
--- a/tests/units/SendgridTest.php
+++ b/tests/units/Integration/SendgridTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Integration\Sendgrid;
use Model\TaskCreation;
diff --git a/tests/units/LocaleTest.php b/tests/units/Locale/LocaleTest.php
index e00b8c83..6cace0d5 100644
--- a/tests/units/LocaleTest.php
+++ b/tests/units/Locale/LocaleTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
class LocaleTest extends Base
{
diff --git a/tests/units/AclTest.php b/tests/units/Model/AclTest.php
index 4d735dfb..fef03990 100644
--- a/tests/units/AclTest.php
+++ b/tests/units/Model/AclTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Session;
use Model\Acl;
diff --git a/tests/units/ActionTest.php b/tests/units/Model/ActionTest.php
index 7e0287a2..9034679b 100644
--- a/tests/units/ActionTest.php
+++ b/tests/units/Model/ActionTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Action;
use Model\Project;
diff --git a/tests/units/AuthenticationTest.php b/tests/units/Model/AuthenticationTest.php
index 75b55ece..7ce81d8b 100644
--- a/tests/units/AuthenticationTest.php
+++ b/tests/units/Model/AuthenticationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Authentication;
diff --git a/tests/units/BoardTest.php b/tests/units/Model/BoardTest.php
index 3542f783..b527e983 100644
--- a/tests/units/BoardTest.php
+++ b/tests/units/Model/BoardTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\Board;
diff --git a/tests/units/CategoryTest.php b/tests/units/Model/CategoryTest.php
index 638f3fe4..0467dda4 100644
--- a/tests/units/CategoryTest.php
+++ b/tests/units/Model/CategoryTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/CommentTest.php b/tests/units/Model/CommentTest.php
index 295ac60e..5e532b8a 100644
--- a/tests/units/CommentTest.php
+++ b/tests/units/Model/CommentTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/ConfigTest.php b/tests/units/Model/ConfigTest.php
index f93619d6..c0ed0313 100644
--- a/tests/units/ConfigTest.php
+++ b/tests/units/Model/ConfigTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Config;
use Core\Session;
diff --git a/tests/units/DateParserTest.php b/tests/units/Model/DateParserTest.php
index 4b3e93c8..23c31f14 100644
--- a/tests/units/DateParserTest.php
+++ b/tests/units/Model/DateParserTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\DateParser;
diff --git a/tests/units/FileTest.php b/tests/units/Model/FileTest.php
index 4ea7f386..da00917d 100644
--- a/tests/units/FileTest.php
+++ b/tests/units/Model/FileTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\File;
diff --git a/tests/units/HourlyRate.php b/tests/units/Model/HourlyRateTest.php
index 5daf0446..ffc0d87e 100644
--- a/tests/units/HourlyRate.php
+++ b/tests/units/Model/HourlyRateTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\User;
use Model\HourlyRate;
diff --git a/tests/units/LinkTest.php b/tests/units/Model/LinkTest.php
index 45e9796c..0399f13e 100644
--- a/tests/units/LinkTest.php
+++ b/tests/units/Model/LinkTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Link;
diff --git a/tests/units/NotificationTest.php b/tests/units/Model/NotificationTest.php
index 4ae46ee3..b0eafc83 100644
--- a/tests/units/NotificationTest.php
+++ b/tests/units/Model/NotificationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\TaskFinder;
use Model\TaskCreation;
diff --git a/tests/units/ProjectActivityTest.php b/tests/units/Model/ProjectActivityTest.php
index f0b27649..fa45d740 100644
--- a/tests/units/ProjectActivityTest.php
+++ b/tests/units/Model/ProjectActivityTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskFinder;
diff --git a/tests/units/ProjectDailyColumnStatsTest.php b/tests/units/Model/ProjectDailyColumnStatsTest.php
index d314ac93..e01bdcc4 100644
--- a/tests/units/ProjectDailyColumnStatsTest.php
+++ b/tests/units/Model/ProjectDailyColumnStatsTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\ProjectDailyColumnStats;
diff --git a/tests/units/ProjectDuplicationTest.php b/tests/units/Model/ProjectDuplicationTest.php
index 0a0bc3eb..0388d4a2 100644
--- a/tests/units/ProjectDuplicationTest.php
+++ b/tests/units/Model/ProjectDuplicationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Action;
use Model\Project;
@@ -20,7 +20,7 @@ class ProjectDuplicationTest extends Base
$pd = new ProjectDuplication($this->container);
$this->assertEquals('test (Clone)', $pd->getClonedProjectName('test'));
-
+
$this->assertEquals(50, strlen($pd->getClonedProjectName(str_repeat('a', 50))));
$this->assertEquals(str_repeat('a', 42).' (Clone)', $pd->getClonedProjectName(str_repeat('a', 50)));
@@ -155,7 +155,7 @@ class ProjectDuplicationTest extends Base
$pd = new ProjectDuplication($this->container);
$this->assertEquals(1, $p->create(array('name' => 'P1')));
-
+
$this->assertEquals(1, $a->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_MOVE_COLUMN,
@@ -185,7 +185,7 @@ class ProjectDuplicationTest extends Base
$this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
$this->assertEquals(2, $c->create(array('name' => 'C2', 'project_id' => 1)));
$this->assertEquals(3, $c->create(array('name' => 'C3', 'project_id' => 1)));
-
+
$this->assertEquals(1, $a->create(array(
'project_id' => 1,
'event_name' => Task::EVENT_CREATE_UPDATE,
diff --git a/tests/units/ProjectPermissionTest.php b/tests/units/Model/ProjectPermissionTest.php
index 9f6d6a52..475dd013 100644
--- a/tests/units/ProjectPermissionTest.php
+++ b/tests/units/Model/ProjectPermissionTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\ProjectPermission;
diff --git a/tests/units/ProjectTest.php b/tests/units/Model/ProjectTest.php
index b7f168d7..97357796 100644
--- a/tests/units/ProjectTest.php
+++ b/tests/units/Model/ProjectTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Translator;
use Subscriber\ProjectModificationDateSubscriber;
diff --git a/tests/units/SubtaskTest.php b/tests/units/Model/SubtaskTest.php
index 3c8cab49..1ef04c32 100644
--- a/tests/units/SubtaskTest.php
+++ b/tests/units/Model/SubtaskTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/SubtaskTimeTrackingTest.php b/tests/units/Model/SubtaskTimeTrackingTest.php
index 94f2ce54..ed286287 100644
--- a/tests/units/SubtaskTimeTrackingTest.php
+++ b/tests/units/Model/SubtaskTimeTrackingTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\TaskFinder;
use Model\TaskCreation;
diff --git a/tests/units/SwimlaneTest.php b/tests/units/Model/SwimlaneTest.php
index af187f41..7e1adb8e 100644
--- a/tests/units/SwimlaneTest.php
+++ b/tests/units/Model/SwimlaneTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\Task;
@@ -219,7 +219,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'Swimlane #3')));
-
+
$swimlane = $s->getById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(1, $swimlane['is_active']);
@@ -302,7 +302,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'Swimlane #3')));
-
+
$swimlane = $s->getById(1);
$this->assertNotEmpty($swimlane);
$this->assertEquals(1, $swimlane['is_active']);
@@ -386,7 +386,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
$this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
$this->assertEquals(3, $s->create(array('project_id' => 1, 'name' => 'S3')));
-
+
$default_swimlane1 = $s->getDefault(1);
$default_swimlane1['default_swimlane'] = 'New Default';
diff --git a/tests/units/TaskCreationTest.php b/tests/units/Model/TaskCreationTest.php
index a77778d6..f292c7f1 100644
--- a/tests/units/TaskCreationTest.php
+++ b/tests/units/Model/TaskCreationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Config;
use Model\Task;
diff --git a/tests/units/TaskDuplicationTest.php b/tests/units/Model/TaskDuplicationTest.php
index 25b9e9fe..56718841 100644
--- a/tests/units/TaskDuplicationTest.php
+++ b/tests/units/Model/TaskDuplicationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
@@ -260,7 +260,7 @@ class TaskDuplicationTest extends Base
$this->assertNotFalse($s->create(array('project_id' => 1, 'name' => 'Swimlane #1')));
$this->assertNotFalse($s->create(array('project_id' => 2, 'name' => 'Swimlane #2')));
-
+
// We create a task
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 2, 'swimlane_id' => 1)));
diff --git a/tests/units/TaskExportTest.php b/tests/units/Model/TaskExportTest.php
index 964418d3..52996369 100644
--- a/tests/units/TaskExportTest.php
+++ b/tests/units/Model/TaskExportTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/TaskFilterTest.php b/tests/units/Model/TaskFilterTest.php
index 07a34691..1987265d 100644
--- a/tests/units/TaskFilterTest.php
+++ b/tests/units/Model/TaskFilterTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Project;
use Model\User;
diff --git a/tests/units/TaskFinderTest.php b/tests/units/Model/TaskFinderTest.php
index 96a3809b..da0db7a7 100644
--- a/tests/units/TaskFinderTest.php
+++ b/tests/units/Model/TaskFinderTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/TaskLinkTest.php b/tests/units/Model/TaskLinkTest.php
index e213e25a..1e79ea74 100644
--- a/tests/units/TaskLinkTest.php
+++ b/tests/units/Model/TaskLinkTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Link;
use Model\TaskLink;
diff --git a/tests/units/TaskModificationTest.php b/tests/units/Model/TaskModificationTest.php
index 4dd89c5e..f85f1c10 100644
--- a/tests/units/TaskModificationTest.php
+++ b/tests/units/Model/TaskModificationTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/TaskMovedDateSubscriberTest.php b/tests/units/Model/TaskMovedDateSubscriberTest.php
index 3b7e494b..6e3fb3bd 100644
--- a/tests/units/TaskMovedDateSubscriberTest.php
+++ b/tests/units/Model/TaskMovedDateSubscriberTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\TaskPosition;
use Model\TaskCreation;
diff --git a/tests/units/TaskPermissionTest.php b/tests/units/Model/TaskPermissionTest.php
index 0bf68ce3..af413a76 100644
--- a/tests/units/TaskPermissionTest.php
+++ b/tests/units/Model/TaskPermissionTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/TaskPositionTest.php b/tests/units/Model/TaskPositionTest.php
index ec0f7927..86814c03 100644
--- a/tests/units/TaskPositionTest.php
+++ b/tests/units/Model/TaskPositionTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\Board;
diff --git a/tests/units/TaskStatusTest.php b/tests/units/Model/TaskStatusTest.php
index c1f79142..e5172c4d 100644
--- a/tests/units/TaskStatusTest.php
+++ b/tests/units/Model/TaskStatusTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Subtask;
use Model\Task;
diff --git a/tests/units/TaskTest.php b/tests/units/Model/TaskTest.php
index d9c0fa4f..ebafa612 100644
--- a/tests/units/TaskTest.php
+++ b/tests/units/Model/TaskTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Task;
use Model\TaskCreation;
diff --git a/tests/units/TimetableTest.php b/tests/units/Model/TimetableTest.php
index 9c40dce1..887e1787 100644
--- a/tests/units/TimetableTest.php
+++ b/tests/units/Model/TimetableTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Timetable;
diff --git a/tests/units/UserSessionTest.php b/tests/units/Model/UserSessionTest.php
index 6a831183..31072e6a 100644
--- a/tests/units/UserSessionTest.php
+++ b/tests/units/Model/UserSessionTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Core\Session;
use Model\UserSession;
diff --git a/tests/units/UserTest.php b/tests/units/Model/UserTest.php
index f63ed3de..5b7edfb9 100644
--- a/tests/units/UserTest.php
+++ b/tests/units/Model/UserTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\User;
use Model\Subtask;
diff --git a/tests/units/WebhookTest.php b/tests/units/Model/WebhookTest.php
index 946d744c..8ed630e4 100644
--- a/tests/units/WebhookTest.php
+++ b/tests/units/Model/WebhookTest.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__.'/Base.php';
+require_once __DIR__.'/../Base.php';
use Model\Config;
use Model\Task;