Kanboard now requires PHP >= 7.2 since other versions are deprecated

This commit is contained in:
Timo 2020-01-14 21:02:31 +01:00 committed by Frédéric Guillot
parent 7731dde413
commit 64397f45fa
39 changed files with 520 additions and 363 deletions

2
.gitignore vendored
View File

@ -21,4 +21,4 @@ data/config.php
*.bak *.bak
/config.php /config.php
!docker/var/wwww/app/config.php !docker/var/wwww/app/config.php
node_modules node_modules

View File

@ -11,9 +11,9 @@ language: php
sudo: false sudo: false
php: php:
- 7.4
- 7.3 - 7.3
- 7.2 - 7.2
- 5.6
env: env:
- DB=sqlite - DB=sqlite
@ -22,8 +22,8 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
before_install: before_script:
- composer install - composer install --no-interaction
- npm install -g jshint - npm install -g jshint
script: script:

View File

@ -223,7 +223,7 @@ class UserSession extends Base
public function getFilters($projectID) public function getFilters($projectID)
{ {
if (! session_exists('filters:'.$projectID)) { if (! session_exists('filters:'.$projectID)) {
return session_get('user')['filter'] ?: 'status:open'; return session_get('user') ? session_get('user')['filter'] ?: 'status:open' : 'status:open';
} }
return session_get('filters:'.$projectID); return session_get('filters:'.$projectID);

View File

@ -1,8 +1,8 @@
<?php <?php
// PHP 5.6.0 minimum // PHP 7.2.0 minimum
if (version_compare(PHP_VERSION, '5.6.0', '<')) { if (version_compare(PHP_VERSION, '7.2.0', '<')) {
throw new Exception('This software requires PHP 5.6.0 minimum'); throw new Exception('This software requires PHP 7.2.0 minimum');
} }
// Check data folder if sqlite // Check data folder if sqlite

View File

@ -14,7 +14,7 @@
"discard-changes": true "discard-changes": true
}, },
"require" : { "require" : {
"php" : ">=5.6.0", "php" : ">=7.2.0",
"ext-simplexml" : "*", "ext-simplexml" : "*",
"ext-dom" : "*", "ext-dom" : "*",
"ext-xml" : "*", "ext-xml" : "*",
@ -50,17 +50,17 @@
] ]
}, },
"require-dev" : { "require-dev" : {
"phpunit/php-code-coverage": "4.0.8", "phpunit/php-code-coverage": "^6",
"phpunit/php-token-stream": "1.4.12", "phpunit/php-token-stream": "^3.1",
"doctrine/instantiator": "1.0.5", "doctrine/instantiator": "^1.1",
"phpdocumentor/reflection-docblock": "3.3.2", "phpdocumentor/reflection-docblock": "3.3.2",
"symfony/debug": "3.4.2", "symfony/debug": "3.4.2",
"symfony/yaml": "3.4.2", "symfony/yaml": "3.4.2",
"symfony/finder": "3.4.8", "symfony/finder": "3.4.8",
"symfony/stopwatch" : "3.4.2", "symfony/stopwatch" : "3.4.2",
"myclabs/deep-copy": "1.7.0", "myclabs/deep-copy": "1.7.0",
"phpunit/phpunit" : "5.7.24", "phpunit/phpunit" : "^7",
"phpunit/phpunit-selenium": "3.0.3", "phpunit/phpunit-selenium": "^7",
"roave/security-advisories": "dev-master" "roave/security-advisories": "dev-master"
} }
} }

660
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -77,7 +77,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
), ),
))); )));
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
$client->execute('methodA', array('a' => 'b')); $client->execute('methodA', array('a' => 'b'));
} }

View File

@ -64,7 +64,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testWithServerError() public function testWithServerError()
{ {
$this->setExpectedException('\JsonRPC\Exception\ServerErrorException'); $this->expectException('\JsonRPC\Exception\ServerErrorException');
$httpClient = new HttpClient(); $httpClient = new HttpClient();
$httpClient->handleExceptions(array( $httpClient->handleExceptions(array(
@ -76,7 +76,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testWithConnectionFailure() public function testWithConnectionFailure()
{ {
$this->setExpectedException('\JsonRPC\Exception\ConnectionFailureException'); $this->expectException('\JsonRPC\Exception\ConnectionFailureException');
$httpClient = new HttpClient(); $httpClient = new HttpClient();
$httpClient->handleExceptions(array( $httpClient->handleExceptions(array(
@ -86,7 +86,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testWithAccessForbidden() public function testWithAccessForbidden()
{ {
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException'); $this->expectException('\JsonRPC\Exception\AccessDeniedException');
$httpClient = new HttpClient(); $httpClient = new HttpClient();
$httpClient->handleExceptions(array( $httpClient->handleExceptions(array(
@ -96,7 +96,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
public function testWithAccessNotAllowed() public function testWithAccessNotAllowed()
{ {
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException'); $this->expectException('\JsonRPC\Exception\AccessDeniedException');
$httpClient = new HttpClient(); $httpClient = new HttpClient();
$httpClient->handleExceptions(array( $httpClient->handleExceptions(array(
@ -149,7 +149,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
$client->withHeaders(array('Content-Length: '.strlen($payload))); $client->withHeaders(array('Content-Length: '.strlen($payload)));
}); });
$this->setExpectedException('\JsonRPC\Exception\ConnectionFailureException'); $this->expectException('\JsonRPC\Exception\ConnectionFailureException');
$httpClient->execute('test'); $httpClient->execute('test');
} }
@ -214,7 +214,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
}); });
$this->setExpectedException('\JsonRPC\Exception\ConnectionFailureException'); $this->expectException('\JsonRPC\Exception\ConnectionFailureException');
$httpClient->execute('test'); $httpClient->execute('test');
} }
} }

View File

@ -27,7 +27,7 @@ class MiddlewareHandlerTest extends PHPUnit_Framework_TestCase
{ {
public function testMiddlewareCanRaiseException() public function testMiddlewareCanRaiseException()
{ {
$this->setExpectedException('JsonRpc\Exception\AuthenticationFailureException'); $this->expectException('JsonRpc\Exception\AuthenticationFailureException');
$middlewareHandler = new MiddlewareHandler(); $middlewareHandler = new MiddlewareHandler();
$middlewareHandler->withUsername('myUsername'); $middlewareHandler->withUsername('myUsername');

View File

@ -39,14 +39,14 @@ class ProcedureHandlerTest extends PHPUnit_Framework_TestCase
{ {
public function testProcedureNotFound() public function testProcedureNotFound()
{ {
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->executeProcedure('a'); $handler->executeProcedure('a');
} }
public function testCallbackNotFound() public function testCallbackNotFound()
{ {
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->withCallback('b', function() {}); $handler->withCallback('b', function() {});
$handler->executeProcedure('a'); $handler->executeProcedure('a');
@ -54,7 +54,7 @@ class ProcedureHandlerTest extends PHPUnit_Framework_TestCase
public function testClassNotFound() public function testClassNotFound()
{ {
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->withClassAndMethod('getAllTasks', 'c', 'getAll'); $handler->withClassAndMethod('getAllTasks', 'c', 'getAll');
$handler->executeProcedure('getAllTasks'); $handler->executeProcedure('getAllTasks');
@ -62,7 +62,7 @@ class ProcedureHandlerTest extends PHPUnit_Framework_TestCase
public function testMethodNotFound() public function testMethodNotFound()
{ {
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->withClassAndMethod('getAllTasks', 'A', 'getNothing'); $handler->withClassAndMethod('getAllTasks', 'A', 'getNothing');
$handler->executeProcedure('getAllTasks'); $handler->executeProcedure('getAllTasks');
@ -127,7 +127,7 @@ class ProcedureHandlerTest extends PHPUnit_Framework_TestCase
public function testTooManyArguments() public function testTooManyArguments()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->withClassAndMethod('getAllC', new B, 'getAll'); $handler->withClassAndMethod('getAllC', new B, 'getAll');
@ -136,7 +136,7 @@ class ProcedureHandlerTest extends PHPUnit_Framework_TestCase
public function testNotEnoughArguments() public function testNotEnoughArguments()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
$handler = new ProcedureHandler; $handler = new ProcedureHandler;
$handler->withClassAndMethod('getAllC', new B, 'getAll'); $handler->withClassAndMethod('getAllC', new B, 'getAll');

View File

@ -17,7 +17,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithBadJsonFormat() public function testWithBadJsonFormat()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonFormatException');
ResponseParser::create() ResponseParser::create()
->withPayload('foobar') ->withPayload('foobar')
@ -26,7 +26,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithBadProcedure() public function testWithBadProcedure()
{ {
$this->setExpectedException('BadFunctionCallException'); $this->expectException('BadFunctionCallException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "1"}', true)) ->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "1"}', true))
@ -35,7 +35,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithInvalidArgs() public function testWithInvalidArgs()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params"}, "id": "1"}', true)) ->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params"}, "id": "1"}', true))
@ -44,7 +44,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithInvalidRequest() public function testWithInvalidRequest()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}', true)) ->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}', true))
@ -53,7 +53,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithParseError() public function testWithParseError()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonFormatException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}', true)) ->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}', true))
@ -62,7 +62,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithOtherError() public function testWithOtherError()
{ {
$this->setExpectedException('\JsonRPC\Exception\ResponseException'); $this->expectException('\JsonRPC\Exception\ResponseException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": 42, "message": "Something", "data": "foobar"}, "id": null}', true)) ->withPayload(json_decode('{"jsonrpc": "2.0", "error": {"code": 42, "message": "Something", "data": "foobar"}, "id": null}', true))
@ -91,7 +91,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params"}, "id": "1"} {"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params"}, "id": "1"}
]'; ]';
$this->setExpectedException('InvalidArgumentException'); $this->expectException('InvalidArgumentException');
ResponseParser::create() ResponseParser::create()
->withPayload(json_decode($payload, true)) ->withPayload(json_decode($payload, true))

View File

@ -222,7 +222,7 @@ class ServerTest extends HeaderMockTest
throw new MyException('test'); throw new MyException('test');
}); });
$this->setExpectedException('MyException'); $this->expectException('MyException');
$server->execute(); $server->execute();
} }

View File

@ -20,13 +20,13 @@ class HostValidatorTest extends PHPUnit_Framework_TestCase
{ {
$this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.1'),'test ip match'); $this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.1'),'test ip match');
$this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.250'),'test ip match'); $this->assertNull(HostValidator::validate(array('192.168.10.1/24'), '192.168.10.250'),'test ip match');
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException'); $this->expectException('\JsonRPC\Exception\AccessDeniedException');
HostValidator::validate(array('192.168.10.1/24'), '192.168.11.1'); HostValidator::validate(array('192.168.10.1/24'), '192.168.11.1');
} }
public function testWithNotAuthorizedHosts() public function testWithNotAuthorizedHosts()
{ {
$this->setExpectedException('\JsonRPC\Exception\AccessDeniedException'); $this->expectException('\JsonRPC\Exception\AccessDeniedException');
HostValidator::validate(array('192.168.1.1'), '127.0.0.1', '127.0.0.1'); HostValidator::validate(array('192.168.1.1'), '127.0.0.1', '127.0.0.1');
} }
} }

View File

@ -16,7 +16,7 @@ class JsonEncodingValidatorTest extends PHPUnit_Framework_TestCase
{ {
json_encode("\xB1\x31"); json_encode("\xB1\x31");
$this->setExpectedException('\JsonRPC\Exception\ResponseEncodingFailureException'); $this->expectException('\JsonRPC\Exception\ResponseEncodingFailureException');
JsonEncodingValidator::validate(); JsonEncodingValidator::validate();
} }
} }

View File

@ -13,7 +13,7 @@ class JsonFormatValidatorTest extends PHPUnit_Framework_TestCase
public function testJsonNotParsedCorrectly() public function testJsonNotParsedCorrectly()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonFormatException');
JsonFormatValidator::validate(''); JsonFormatValidator::validate('');
} }
} }

View File

@ -13,31 +13,31 @@ class RpcFormatValidatorTest extends PHPUnit_Framework_TestCase
public function testWithNoVersion() public function testWithNoVersion()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('method' => 'foobar')); RpcFormatValidator::validate(array('method' => 'foobar'));
} }
public function testWithNoMethod() public function testWithNoMethod()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '2.0')); RpcFormatValidator::validate(array('jsonrpc' => '2.0'));
} }
public function testWithMethodNotString() public function testWithMethodNotString()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '2.0', 'method' => array())); RpcFormatValidator::validate(array('jsonrpc' => '2.0', 'method' => array()));
} }
public function testWithBadVersion() public function testWithBadVersion()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '1.0', 'method' => 'abc')); RpcFormatValidator::validate(array('jsonrpc' => '1.0', 'method' => 'abc'));
} }
public function testWithBadParams() public function testWithBadParams()
{ {
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException'); $this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '2.0', 'method' => 'abc', 'params' => 'foobar')); RpcFormatValidator::validate(array('jsonrpc' => '2.0', 'method' => 'abc', 'params' => 'foobar'));
} }

View File

@ -18,7 +18,7 @@ class UserValidatorTest extends PHPUnit_Framework_TestCase
public function testWithNotAuthorizedHosts() public function testWithNotAuthorizedHosts()
{ {
$this->setExpectedException('\JsonRPC\Exception\AuthenticationFailureException'); $this->expectException('\JsonRPC\Exception\AuthenticationFailureException');
UserValidator::validate(array('user' => 'pass'), 'user', 'wrong password'); UserValidator::validate(array('user' => 'pass'), 'user', 'wrong password');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
class DefaultConfigFileTest extends PHPUnit_Framework_TestCase class DefaultConfigFileTest extends PHPUnit\Framework\TestCase
{ {
public function testThatFileCanBeImported() public function testThatFileCanBeImported()
{ {

View File

@ -6,25 +6,25 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
{ {
public function testApiCredentialDoNotHaveAccessToUserCredentialProcedure() public function testApiCredentialDoNotHaveAccessToUserCredentialProcedure()
{ {
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->app->getMe(); $this->app->getMe();
} }
public function testUserCredentialDoNotHaveAccessToAdminProcedures() public function testUserCredentialDoNotHaveAccessToAdminProcedures()
{ {
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getUser(1); $this->user->getUser(1);
} }
public function testManagerCredentialDoNotHaveAccessToAdminProcedures() public function testManagerCredentialDoNotHaveAccessToAdminProcedures()
{ {
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getAllProjects(); $this->user->getAllProjects();
} }
public function testUserCredentialDoNotHaveAccessToManagerProcedures() public function testUserCredentialDoNotHaveAccessToManagerProcedures()
{ {
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->createProject('Team project creation are only for app managers'); $this->user->createProject('Team project creation are only for app managers');
} }
@ -38,7 +38,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$projectId = $this->admin->createProject('Team project created by admin'); $projectId = $this->admin->createProject('Team project created by admin');
$this->assertNotFalse($projectId); $this->assertNotFalse($projectId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->assertNotNull($this->manager->getProjectById($projectId)); $this->assertNotNull($this->manager->getProjectById($projectId));
} }
@ -61,7 +61,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$projectId = $this->manager->createProject('A team project without members'); $projectId = $this->manager->createProject('A team project without members');
$this->assertNotFalse($projectId); $this->assertNotFalse($projectId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getProjectById($projectId); $this->user->getProjectById($projectId);
} }
@ -90,7 +90,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$actionId = $this->manager->createAction($projectId, 'task.move.column', '\Kanboard\Action\TaskCloseColumn', array('column_id' => 1)); $actionId = $this->manager->createAction($projectId, 'task.move.column', '\Kanboard\Action\TaskCloseColumn', array('column_id' => 1));
$this->assertNotFalse($actionId); $this->assertNotFalse($actionId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeAction($projectId); $this->user->removeAction($projectId);
} }
@ -108,7 +108,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member')); $this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeAction($actionId); $this->user->removeAction($actionId);
} }
@ -140,7 +140,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$categoryId = $this->manager->createCategory($projectId, 'Test'); $categoryId = $this->manager->createCategory($projectId, 'Test');
$this->assertNotFalse($categoryId); $this->assertNotFalse($categoryId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeCategory($categoryId); $this->user->removeCategory($categoryId);
} }
@ -157,7 +157,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertNotFalse($categoryId); $this->assertNotFalse($categoryId);
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member')); $this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeCategory($categoryId); $this->user->removeCategory($categoryId);
} }
@ -189,7 +189,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$columnId = $this->manager->addColumn($projectId, 'Test'); $columnId = $this->manager->addColumn($projectId, 'Test');
$this->assertNotFalse($columnId); $this->assertNotFalse($columnId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeColumn($columnId); $this->user->removeColumn($columnId);
} }
@ -206,7 +206,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertNotFalse($columnId); $this->assertNotFalse($columnId);
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member')); $this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeColumn($columnId); $this->user->removeColumn($columnId);
} }
@ -242,7 +242,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$commentId = $this->manager->createComment($taskId, $this->userUserId, 'My comment'); $commentId = $this->manager->createComment($taskId, $this->userUserId, 'My comment');
$this->assertNotFalse($commentId); $this->assertNotFalse($commentId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->updateComment($commentId, 'something else'); $this->user->updateComment($commentId, 'something else');
} }
@ -281,7 +281,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$subtaskId = $this->manager->createSubtask($taskId, 'My subtask'); $subtaskId = $this->manager->createSubtask($taskId, 'My subtask');
$this->assertNotFalse($subtaskId); $this->assertNotFalse($subtaskId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException'); $this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeSubtask($subtaskId); $this->user->removeSubtask($subtaskId);
} }

View File

@ -11,7 +11,7 @@ use Kanboard\Core\Log\Logger;
use Kanboard\Core\Session\FlashMessage; use Kanboard\Core\Session\FlashMessage;
use Kanboard\ServiceProvider\ActionProvider; use Kanboard\ServiceProvider\ActionProvider;
abstract class Base extends PHPUnit_Framework_TestCase abstract class Base extends PHPUnit\Framework\TestCase
{ {
protected $container; protected $container;

View File

@ -26,7 +26,7 @@ class ActionManagerTest extends Base
public function testGetActionNotFound() public function testGetActionNotFound()
{ {
$this->setExpectedException('RuntimeException', 'Automatic Action Not Found: foobar'); $this->expectException('RuntimeException', 'Automatic Action Not Found: foobar');
$actionManager = new ActionManager($this->container); $actionManager = new ActionManager($this->container);
$actionManager->getAction('foobar'); $actionManager->getAction('foobar');
} }

View File

@ -25,7 +25,7 @@ class ExternalLinkManagerTest extends Base
{ {
$externalLinkManager = new ExternalLinkManager($this->container); $externalLinkManager = new ExternalLinkManager($this->container);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound'); $this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->getProvider('not found'); $externalLinkManager->getProvider('not found');
} }
@ -68,7 +68,7 @@ class ExternalLinkManagerTest extends Base
$externalLinkManager->register($webLinkProvider); $externalLinkManager->register($webLinkProvider);
$externalLinkManager->register($attachmentLinkProvider); $externalLinkManager->register($attachmentLinkProvider);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound'); $this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->find(); $externalLinkManager->find();
} }
@ -113,7 +113,7 @@ class ExternalLinkManagerTest extends Base
$externalLinkManager->register($webLinkProvider); $externalLinkManager->register($webLinkProvider);
$externalLinkManager->register($attachmentLinkProvider); $externalLinkManager->register($attachmentLinkProvider);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound'); $this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->setUserInput(array('text' => 'https://google.com/', 'type' => 'not found')); $externalLinkManager->setUserInput(array('text' => 'https://google.com/', 'type' => 'not found'));
$externalLinkManager->find(); $externalLinkManager->find();
} }

View File

@ -8,7 +8,7 @@ class ExternalTaskManagerTest extends Base
{ {
public function testProviderNotFound() public function testProviderNotFound()
{ {
$this->setExpectedException('Kanboard\Core\ExternalTask\ProviderNotFoundException'); $this->expectException('Kanboard\Core\ExternalTask\ProviderNotFoundException');
$manager = new ExternalTaskManager(); $manager = new ExternalTaskManager();
$manager->getProvider('foobar'); $manager->getProvider('foobar');

View File

@ -68,7 +68,7 @@ class ClientTest extends \Base
public function testGetLdapServerNotConfigured() public function testGetLdapServerNotConfigured()
{ {
$this->setExpectedException('\LogicException'); $this->expectException('\LogicException');
$ldap = new Client; $ldap = new Client;
$ldap->getLdapServer(); $ldap->getLdapServer();
} }
@ -100,7 +100,7 @@ class ClientTest extends \Base
) )
->will($this->returnValue(false)); ->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException'); $this->expectException('\Kanboard\Core\Ldap\ConnectionException');
$ldap = new Client; $ldap = new Client;
$ldap->open('my_ldap_server'); $ldap->open('my_ldap_server');
@ -150,7 +150,7 @@ class ClientTest extends \Base
) )
->will($this->returnValue(false)); ->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException'); $this->expectException('\Kanboard\Core\Ldap\ConnectionException');
$ldap = new Client; $ldap = new Client;
$ldap->open('my_ldap_server', 389, true); $ldap->open('my_ldap_server', 389, true);
@ -175,7 +175,7 @@ class ClientTest extends \Base
->method('ldap_bind') ->method('ldap_bind')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ClientException'); $this->expectException('\Kanboard\Core\Ldap\ClientException');
$ldap = new Client; $ldap = new Client;
$ldap->useAnonymousAuthentication(); $ldap->useAnonymousAuthentication();
@ -228,7 +228,7 @@ class ClientTest extends \Base
) )
->will($this->returnValue(false)); ->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ClientException'); $this->expectException('\Kanboard\Core\Ldap\ClientException');
$ldap = new Client; $ldap = new Client;
$ldap->open('my_ldap_server'); $ldap->open('my_ldap_server');

View File

@ -151,7 +151,7 @@ class LdapGroupTest extends Base
public function testGetBaseDnNotConfigured() public function testGetBaseDnNotConfigured()
{ {
$this->setExpectedException('\LogicException'); $this->expectException('\LogicException');
$group = new Group($this->query); $group = new Group($this->query);
$group->getBasDn(); $group->getBasDn();

View File

@ -787,7 +787,7 @@ class LdapUserTest extends Base
public function testGetBaseDnNotConfigured() public function testGetBaseDnNotConfigured()
{ {
$this->setExpectedException('\LogicException'); $this->expectException('\LogicException');
$user = new User($this->query); $user = new User($this->query);
$user->getBasDn(); $user->getBasDn();
@ -795,7 +795,7 @@ class LdapUserTest extends Base
public function testGetLdapUserPatternNotConfigured() public function testGetLdapUserPatternNotConfigured()
{ {
$this->setExpectedException('\LogicException'); $this->expectException('\LogicException');
$user = new User($this->query); $user = new User($this->query);
$user->getLdapUserPattern('test'); $user->getLdapUserPattern('test');

View File

@ -22,14 +22,14 @@ class AuthenticationManagerTest extends Base
public function testGetProviderNotFound() public function testGetProviderNotFound()
{ {
$authManager = new AuthenticationManager($this->container); $authManager = new AuthenticationManager($this->container);
$this->setExpectedException('LogicException'); $this->expectException('LogicException');
$authManager->getProvider('Dababase'); $authManager->getProvider('Dababase');
} }
public function testGetPostProviderNotFound() public function testGetPostProviderNotFound()
{ {
$authManager = new AuthenticationManager($this->container); $authManager = new AuthenticationManager($this->container);
$this->setExpectedException('LogicException'); $this->expectException('LogicException');
$authManager->getPostAuthenticationProvider(); $authManager->getPostAuthenticationProvider();
} }

View File

@ -8,7 +8,7 @@ class LdapBackendGroupProviderTest extends Base
{ {
public function testGetLdapGroupPattern() public function testGetLdapGroupPattern()
{ {
$this->setExpectedException('LogicException', 'LDAP group filter empty, check the parameter LDAP_GROUP_FILTER'); $this->expectException('LogicException', 'LDAP group filter empty, check the parameter LDAP_GROUP_FILTER');
$backend = new LdapBackendGroupProvider($this->container); $backend = new LdapBackendGroupProvider($this->container);
$backend->getLdapGroupPattern('test'); $backend->getLdapGroupPattern('test');

View File

@ -45,7 +45,7 @@ class ApplicationAuthorizationMiddlewareMiddlewareTest extends Base
->expects($this->never()) ->expects($this->never())
->method('execute'); ->method('execute');
$this->setExpectedException('Kanboard\Core\Controller\AccessForbiddenException'); $this->expectException('Kanboard\Core\Controller\AccessForbiddenException');
$this->middleware->execute(); $this->middleware->execute();
} }

View File

@ -56,7 +56,7 @@ class ProjectAuthorizationMiddlewareMiddlewareTest extends Base
->expects($this->never()) ->expects($this->never())
->method('execute'); ->method('execute');
$this->setExpectedException('Kanboard\Core\Controller\AccessForbiddenException'); $this->expectException('Kanboard\Core\Controller\AccessForbiddenException');
$this->middleware->execute(); $this->middleware->execute();
} }

View File

@ -388,10 +388,10 @@ class UserModelTest extends Base
$projectModel = new ProjectModel($this->container); $projectModel = new ProjectModel($this->container);
$this->assertEquals(2, $userModel->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto'))); $this->assertEquals(2, $userModel->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1', 'is_private' => 1, 'owner_id' => 2))); $this->assertEquals(1, $projectModel->create(array('name' => 'Project #1', 'is_private' => 1), 2));
$this->assertTrue($userModel->disable(2)); $this->assertTrue($userModel->disable(2));
$project = $projectModel->getById(2); $project = $projectModel->getById(1);
$this->assertEquals(0, $project['is_active']); $this->assertEquals(0, $project['is_active']);
} }
} }

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e::getLoader(); return ComposerAutoloaderInit094f3eabe2924332bc2198a9ba245f27::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e class ComposerAutoloaderInit094f3eabe2924332bc2198a9ba245f27
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit094f3eabe2924332bc2198a9ba245f27', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit094f3eabe2924332bc2198a9ba245f27', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInitbdc3716ceecc7570f8ff9a8407f0ca0e
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$files; $includeFiles = Composer\Autoload\ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirebdc3716ceecc7570f8ff9a8407f0ca0e($fileIdentifier, $file); composerRequire094f3eabe2924332bc2198a9ba245f27($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequirebdc3716ceecc7570f8ff9a8407f0ca0e($fileIdentifier, $file) function composerRequire094f3eabe2924332bc2198a9ba245f27($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e class ComposerStaticInit094f3eabe2924332bc2198a9ba245f27
{ {
public static $files = array ( public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -1082,11 +1082,11 @@ class ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$prefixesPsr0; $loader->prefixesPsr0 = ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$prefixesPsr0;
$loader->fallbackDirsPsr0 = ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$fallbackDirsPsr0; $loader->fallbackDirsPsr0 = ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$fallbackDirsPsr0;
$loader->classMap = ComposerStaticInitbdc3716ceecc7570f8ff9a8407f0ca0e::$classMap; $loader->classMap = ComposerStaticInit094f3eabe2924332bc2198a9ba245f27::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -772,17 +772,17 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.12.0", "version": "v1.13.1",
"version_normalized": "1.12.0.0", "version_normalized": "1.13.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -791,11 +791,11 @@
"suggest": { "suggest": {
"ext-mbstring": "For best performance" "ext-mbstring": "For best performance"
}, },
"time": "2019-08-06T08:03:45+00:00", "time": "2019-11-27T14:18:11+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.12-dev" "dev-master": "1.13-dev"
} }
}, },
"installation-source": "dist", "installation-source": "dist",

0
vendor/paragonie/random_compat/build-phar.sh vendored Executable file → Normal file
View File

View File

View File

@ -512,7 +512,9 @@ final class Mbstring
$offset = 0; $offset = 0;
} elseif ($offset = (int) $offset) { } elseif ($offset = (int) $offset) {
if ($offset < 0) { if ($offset < 0) {
$haystack = self::mb_substr($haystack, 0, $offset, $encoding); if (0 > $offset += self::mb_strlen($needle)) {
$haystack = self::mb_substr($haystack, 0, $offset, $encoding);
}
$offset = 0; $offset = 0;
} else { } else {
$haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
@ -532,7 +534,7 @@ final class Mbstring
return null; return null;
} }
if ($split_length < 1) { if (1 > $split_length = (int) $split_length) {
trigger_error('The length of each segment must be greater than zero', E_USER_WARNING); trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
return false; return false;
@ -542,6 +544,10 @@ final class Mbstring
$encoding = mb_internal_encoding(); $encoding = mb_internal_encoding();
} }
if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
return preg_split("/(.{{$split_length}})/u", $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
}
$result = array(); $result = array();
$length = mb_strlen($string, $encoding); $length = mb_strlen($string, $encoding);
@ -815,11 +821,16 @@ final class Mbstring
return self::$internalEncoding; return self::$internalEncoding;
} }
if ('UTF-8' === $encoding) {
return 'UTF-8';
}
$encoding = strtoupper($encoding); $encoding = strtoupper($encoding);
if ('8BIT' === $encoding || 'BINARY' === $encoding) { if ('8BIT' === $encoding || 'BINARY' === $encoding) {
return 'CP850'; return 'CP850';
} }
if ('UTF8' === $encoding) { if ('UTF8' === $encoding) {
return 'UTF-8'; return 'UTF-8';
} }

View File

@ -28,7 +28,7 @@
"minimum-stability": "dev", "minimum-stability": "dev",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.12-dev" "dev-master": "1.13-dev"
} }
} }
} }