mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 02:11:45 +01:00
Support PHP 5.5.9+
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM php:5.6-cli
|
||||
FROM php:5.5-cli
|
||||
|
||||
#
|
||||
# Tools & libraries
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"php": ">=5.5.9",
|
||||
"fguillot/json-rpc": "^1.2",
|
||||
"wiosna/common-library": "~0.0.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7",
|
||||
"squizlabs/php_codesniffer": "^2.9",
|
||||
"phpmd/phpmd": "^2.6",
|
||||
"sebastian/phpcpd": "^3.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.2",
|
||||
"pdepend/pdepend": "^2.5",
|
||||
"phploc/phploc": "^4.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.6"
|
||||
"phploc/phploc": "^2.1",
|
||||
"phpmd/phpmd": "^2.6",
|
||||
"phpunit/phpunit": "^4.8",
|
||||
"sebastian/phpcpd": "^2.0",
|
||||
"squizlabs/php_codesniffer": "^2.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -45,7 +45,7 @@ class ClientTest extends BaseTestCase
|
||||
*/
|
||||
public function testRunWithIncorrectMethod($incorrectMethod)
|
||||
{
|
||||
$this->expectException(UnknownMethodException::class);
|
||||
$this->setExpectedException(UnknownMethodException::class);
|
||||
|
||||
$client = new Client($this->configuration);
|
||||
$client->run($incorrectMethod);
|
||||
@@ -61,8 +61,8 @@ class ClientTest extends BaseTestCase
|
||||
*/
|
||||
public function testRun($method, $arguments, $debugMode, $expectedRawData)
|
||||
{
|
||||
$sessionManager = $this->createMock(SessionManager::class);
|
||||
$rpcClientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$sessionManager = $this->getMock(SessionManager::class, [], [], '', false);
|
||||
$rpcClientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$rpcClientManager
|
||||
->expects(static::any())
|
||||
|
||||
@@ -47,7 +47,7 @@ class ConnectionConfigurationTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorWithEmptyBaseUrl($emptyBaseUrl)
|
||||
{
|
||||
$this->expectException(InvalidUrlException::class);
|
||||
$this->setExpectedException(InvalidUrlException::class);
|
||||
new ConnectionConfiguration($emptyBaseUrl, '', '');
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConnectionConfigurationTest extends BaseTestCase
|
||||
*/
|
||||
public function testConstructorWithInvalidBaseUrl($invalidBaseUrl)
|
||||
{
|
||||
$this->expectException(InvalidUrlException::class);
|
||||
$this->setExpectedException(InvalidUrlException::class);
|
||||
new ConnectionConfiguration($invalidBaseUrl, '', '');
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testRunMethodWithEmptyArrayReturned()
|
||||
{
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$rpcClient = $this->getMock(RpcClient::class);
|
||||
|
||||
$manager = $this
|
||||
->getMockBuilder(JsonRpcClientManager::class)
|
||||
@@ -68,8 +68,8 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testRunMethodWithRawDataReturned()
|
||||
{
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$manager = $this->createPartialMock(JsonRpcClientManager::class, ['getRpcClient']);
|
||||
$rpcClient = $this->getMock(RpcClient::class);
|
||||
$manager = $this->getMock(JsonRpcClientManager::class, ['getRpcClient'], [], '', false);
|
||||
|
||||
$rpcClient
|
||||
->expects(static::once())
|
||||
@@ -87,10 +87,10 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testRunMethodWithException()
|
||||
{
|
||||
$this->expectException(InvalidResultOfMethodRunException::class);
|
||||
$this->setExpectedException(InvalidResultOfMethodRunException::class);
|
||||
|
||||
$manager = $this->createPartialMock(JsonRpcClientManager::class, ['getRpcClient']);
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$manager = $this->getMock(JsonRpcClientManager::class, ['getRpcClient'], [], '', false);
|
||||
$rpcClient = $this->getMock(RpcClient::class);
|
||||
|
||||
$rpcClient
|
||||
->expects(self::once())
|
||||
|
||||
@@ -29,10 +29,9 @@ class SessionManagerTest extends BaseTestCase
|
||||
|
||||
public function testGetSessionKeyWhenFailedWithoutReason()
|
||||
{
|
||||
$this->expectException(CreateSessionKeyFailedException::class);
|
||||
$this->expectExceptionMessage('Create of the session key has failed');
|
||||
$this->setExpectedException(CreateSessionKeyFailedException::class, 'Create of the session key has failed');
|
||||
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -46,10 +45,10 @@ class SessionManagerTest extends BaseTestCase
|
||||
{
|
||||
$reason = 'Invalid credentials';
|
||||
|
||||
$this->expectException(CreateSessionKeyFailedException::class);
|
||||
$this->expectExceptionMessage(sprintf('Create of the session key has failed. Reason: \'%s\'.', $reason));
|
||||
$message = sprintf('Create of the session key has failed. Reason: \'%s\'.', $reason);
|
||||
$this->setExpectedException(CreateSessionKeyFailedException::class, $message);
|
||||
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -63,7 +62,7 @@ class SessionManagerTest extends BaseTestCase
|
||||
|
||||
public function testGetSessionKey()
|
||||
{
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -76,7 +75,7 @@ class SessionManagerTest extends BaseTestCase
|
||||
|
||||
public function testReleaseSessionKey()
|
||||
{
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
|
||||
@@ -52,19 +52,19 @@ class ParticipantsTest extends BaseTestCase
|
||||
|
||||
public function testAdd()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new Participants())->add('');
|
||||
}
|
||||
|
||||
public function testAddMultiple()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new Participants())->addMultiple([]);
|
||||
}
|
||||
|
||||
public function testHas()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new Participants())->has(new Participant());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,19 +44,19 @@ class SurveysSummariesTest extends BaseTestCase
|
||||
|
||||
public function testAdd()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new SurveysSummaries())->add('');
|
||||
}
|
||||
|
||||
public function testAddMultiple()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new SurveysSummaries())->addMultiple([]);
|
||||
}
|
||||
|
||||
public function testHas()
|
||||
{
|
||||
$this->expectException(DisabledMethodException::class);
|
||||
$this->setExpectedException(DisabledMethodException::class);
|
||||
(new SurveysSummaries())->has(new SurveySummary());
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class ResultProcessorTest extends BaseTestCase
|
||||
|
||||
public function testRunWithUnknownResultClass()
|
||||
{
|
||||
$this->expectException(UnknownInstanceOfResultItem::class);
|
||||
$this->setExpectedException(UnknownInstanceOfResultItem::class);
|
||||
|
||||
$rawData = [
|
||||
'lorem' => 'ipsum',
|
||||
|
||||
@@ -128,7 +128,7 @@ class ResultTest extends BaseTestCase
|
||||
|
||||
public function testGetDataUsingProcessedDataWhoCannotBeProcessed()
|
||||
{
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->setExpectedException(CannotProcessDataException::class);
|
||||
$this->statusInsteadDataResult->getData();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,9 +112,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
public function testGetParticipantDetailsWithException()
|
||||
{
|
||||
$exception = new CannotProcessDataException(ReasonType::NOT_EXISTING_SURVEY_ID);
|
||||
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->expectExceptionMessage($exception->getMessage());
|
||||
$this->setExpectedException(CannotProcessDataException::class, $exception->getMessage());
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManagerWithException(1, $exception);
|
||||
$sessionManager = $this->getSessionManager();
|
||||
@@ -158,7 +156,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
|
||||
public function testHasParticipantFilledSurveyWithoutParticipants()
|
||||
{
|
||||
$this->expectException(MissingParticipantOfSurveyException::class);
|
||||
$this->setExpectedException(MissingParticipantOfSurveyException::class);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManager(1);
|
||||
$sessionManager = $this->getSessionManager();
|
||||
@@ -178,7 +176,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
|
||||
public function testHasParticipantFilledSurveyUsingNotExistingParticipant()
|
||||
{
|
||||
$this->expectException(MissingParticipantOfSurveyException::class);
|
||||
$this->setExpectedException(MissingParticipantOfSurveyException::class);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManager(1);
|
||||
$sessionManager = $this->getSessionManager();
|
||||
@@ -253,7 +251,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getSessionManager()
|
||||
{
|
||||
return $this->createMock(SessionManager::class);
|
||||
return $this->getMock(SessionManager::class, [], [], '', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +263,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getJsonRpcClientManager($runMethodCallCount, array $runMethodCallResults = [])
|
||||
{
|
||||
$rpcClientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$rpcClientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$mocker = $rpcClientManager
|
||||
->expects(static::exactly($runMethodCallCount))
|
||||
@@ -297,7 +295,7 @@ class ParticipantServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getJsonRpcClientManagerWithException($runMethodCallCount, Exception $exception)
|
||||
{
|
||||
$rpcClientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$rpcClientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$rpcClientManager
|
||||
->expects(static::exactly($runMethodCallCount))
|
||||
|
||||
@@ -100,7 +100,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
|
||||
public function testGetAllSurveysWithNoTableException()
|
||||
{
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->setExpectedException(CannotProcessDataException::class);
|
||||
$exception = new CannotProcessDataException(ReasonType::NO_TOKEN_TABLE);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManagerWithException(1, $exception);
|
||||
@@ -224,9 +224,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
public function testGetSurveyParticipantsWithNotExistingSurveyException()
|
||||
{
|
||||
$exception = new CannotProcessDataException(ReasonType::NOT_EXISTING_SURVEY_ID);
|
||||
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->expectExceptionMessage($exception->getMessage());
|
||||
$this->setExpectedException(CannotProcessDataException::class, $exception->getMessage());
|
||||
|
||||
$runMethodCallResults = [
|
||||
[
|
||||
@@ -332,7 +330,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
|
||||
public function testGetSurveyParticipantsWithNoTableException()
|
||||
{
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->setExpectedException(CannotProcessDataException::class);
|
||||
$exception = new CannotProcessDataException(ReasonType::NO_TOKEN_TABLE);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManagerWithException(1, $exception);
|
||||
@@ -344,7 +342,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
|
||||
public function testGetSurveyParticipantsWithNoParticipantsException()
|
||||
{
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->setExpectedException(CannotProcessDataException::class);
|
||||
$exception = new CannotProcessDataException(ReasonType::NO_PARTICIPANTS_FOUND);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManagerWithException(1, $exception);
|
||||
@@ -356,7 +354,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
|
||||
public function testAddParticipantForNotExistingSurvey()
|
||||
{
|
||||
$this->expectException(CannotProcessDataException::class);
|
||||
$this->setExpectedException(CannotProcessDataException::class);
|
||||
$exception = new CannotProcessDataException(ReasonType::NOT_EXISTING_SURVEY_ID);
|
||||
|
||||
$rpcClientManager = $this->getJsonRpcClientManagerWithException(1, $exception);
|
||||
@@ -466,7 +464,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
|
||||
public function testGetSurveyTokenCountWithException()
|
||||
{
|
||||
$this->expectException(MissingSurveySummaryException::class);
|
||||
$this->setExpectedException(MissingSurveySummaryException::class);
|
||||
|
||||
$runMethodCallResults = [
|
||||
null,
|
||||
@@ -496,7 +494,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getSessionManager()
|
||||
{
|
||||
return $this->createMock(SessionManager::class);
|
||||
return $this->getMock(SessionManager::class, [], [], '', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,7 +506,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getJsonRpcClientManager($runMethodCallCount, array $runMethodCallResults = [])
|
||||
{
|
||||
$rpcClientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$rpcClientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$mocker = $rpcClientManager
|
||||
->expects(static::exactly($runMethodCallCount))
|
||||
@@ -540,7 +538,7 @@ class SurveyServiceTest extends BaseTestCase
|
||||
*/
|
||||
private function getJsonRpcClientManagerWithException($runMethodCallCount, Exception $exception)
|
||||
{
|
||||
$rpcClientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$rpcClientManager = $this->getMock(JsonRpcClientManager::class, [], [], '', false);
|
||||
|
||||
$rpcClientManager
|
||||
->expects(static::exactly($runMethodCallCount))
|
||||
|
||||
@@ -33,7 +33,7 @@ class MethodTypeTest extends BaseTypeTestCase
|
||||
*/
|
||||
public function testGetValidatedMethodWithIncorrectMethod($incorrectMethod)
|
||||
{
|
||||
$this->expectException(UnknownMethodException::class);
|
||||
$this->setExpectedException(UnknownMethodException::class);
|
||||
MethodType::getValidatedMethod($incorrectMethod);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class MethodTypeTest extends BaseTypeTestCase
|
||||
*/
|
||||
public function testIsResultIterableWithIncorrectMethod($incorrectMethod)
|
||||
{
|
||||
$this->expectException(UnknownMethodException::class);
|
||||
$this->setExpectedException(UnknownMethodException::class);
|
||||
MethodType::isResultIterable($incorrectMethod);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user