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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,7 +17,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithBadJsonFormat()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonFormatException');
ResponseParser::create()
->withPayload('foobar')
@@ -26,7 +26,7 @@ class ResponseParserTest extends PHPUnit_Framework_TestCase
public function testWithBadProcedure()
{
$this->setExpectedException('BadFunctionCallException');
$this->expectException('BadFunctionCallException');
ResponseParser::create()
->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()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
ResponseParser::create()
->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()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
ResponseParser::create()
->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()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonFormatException');
ResponseParser::create()
->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()
{
$this->setExpectedException('\JsonRPC\Exception\ResponseException');
$this->expectException('\JsonRPC\Exception\ResponseException');
ResponseParser::create()
->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"}
]';
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
ResponseParser::create()
->withPayload(json_decode($payload, true))

View File

@@ -222,7 +222,7 @@ class ServerTest extends HeaderMockTest
throw new MyException('test');
});
$this->setExpectedException('MyException');
$this->expectException('MyException');
$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.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');
}
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');
}
}

View File

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

View File

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

View File

@@ -13,31 +13,31 @@ class RpcFormatValidatorTest extends PHPUnit_Framework_TestCase
public function testWithNoVersion()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('method' => 'foobar'));
}
public function testWithNoMethod()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '2.0'));
}
public function testWithMethodNotString()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '2.0', 'method' => array()));
}
public function testWithBadVersion()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
RpcFormatValidator::validate(array('jsonrpc' => '1.0', 'method' => 'abc'));
}
public function testWithBadParams()
{
$this->setExpectedException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
$this->expectException('\JsonRPC\Exception\InvalidJsonRpcFormatException');
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()
{
$this->setExpectedException('\JsonRPC\Exception\AuthenticationFailureException');
$this->expectException('\JsonRPC\Exception\AuthenticationFailureException');
UserValidator::validate(array('user' => 'pass'), 'user', 'wrong password');
}
}