mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 10:11:49 +01:00
Support PHP 5.4
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace Meritoo\LimeSurvey\Test\ApiClient\Manager;
|
||||
|
||||
use JsonRPC\Client as RpcClient;
|
||||
use JsonRPC\Exception\InvalidJsonFormatException;
|
||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||
use Meritoo\Common\Type\OopVisibilityType;
|
||||
@@ -35,15 +34,15 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(JsonRpcClientManager::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(JsonRpcClientManager::className, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
}
|
||||
|
||||
public function testRunMethodWithEmptyArrayReturned()
|
||||
{
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$rpcClient = $this->createMock('\JsonRPC\Client');
|
||||
|
||||
$manager = $this
|
||||
->getMockBuilder(JsonRpcClientManager::class)
|
||||
->getMockBuilder(JsonRpcClientManager::className)
|
||||
->setConstructorArgs([
|
||||
$this->configuration,
|
||||
])
|
||||
@@ -68,8 +67,8 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testRunMethodWithRawDataReturned()
|
||||
{
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$manager = $this->createPartialMock(JsonRpcClientManager::class, ['getRpcClient']);
|
||||
$rpcClient = $this->createMock('\JsonRPC\Client');
|
||||
$manager = $this->getMock(JsonRpcClientManager::className, ['getRpcClient'], [], '', false);
|
||||
|
||||
$rpcClient
|
||||
->expects(static::once())
|
||||
@@ -87,10 +86,10 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testRunMethodWithException()
|
||||
{
|
||||
$this->expectException(InvalidResultOfMethodRunException::class);
|
||||
$this->setExpectedException(InvalidResultOfMethodRunException::className);
|
||||
|
||||
$manager = $this->createPartialMock(JsonRpcClientManager::class, ['getRpcClient']);
|
||||
$rpcClient = $this->createMock(RpcClient::class);
|
||||
$manager = $this->getMock(JsonRpcClientManager::className, ['getRpcClient'], [], '', false);
|
||||
$rpcClient = $this->createMock('\JsonRPC\Client');
|
||||
|
||||
$rpcClient
|
||||
->expects(self::once())
|
||||
@@ -108,7 +107,7 @@ class JsonRpcClientManagerTest extends BaseTestCase
|
||||
|
||||
public function testGetRpcClientVisibilityAndArguments()
|
||||
{
|
||||
static::assertMethodVisibilityAndArguments(JsonRpcClientManager::class, 'getRpcClient', OopVisibilityType::IS_PROTECTED);
|
||||
static::assertMethodVisibilityAndArguments(JsonRpcClientManager::className, 'getRpcClient', OopVisibilityType::IS_PROTECTED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,15 +24,15 @@ class SessionManagerTest extends BaseTestCase
|
||||
{
|
||||
public function testConstructorVisibilityAndArguments()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(SessionManager::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
static::assertConstructorVisibilityAndArguments(SessionManager::className, OopVisibilityType::IS_PUBLIC, 1, 1);
|
||||
}
|
||||
|
||||
public function testGetSessionKeyWhenFailedWithoutReason()
|
||||
{
|
||||
$this->expectException(CreateSessionKeyFailedException::class);
|
||||
$this->expectExceptionMessage('Create of the session key has failed');
|
||||
$this->setExpectedException(CreateSessionKeyFailedException::className, 'Create of the session key has failed');
|
||||
//$this->expectExceptionMessage('Create of the session key has failed');
|
||||
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::className);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -46,10 +46,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));
|
||||
$this->setExpectedException(CreateSessionKeyFailedException::className, sprintf('Create of the session key has failed. Reason: \'%s\'.', $reason));
|
||||
//$this->expectExceptionMessage(sprintf('Create of the session key has failed. Reason: \'%s\'.', $reason));
|
||||
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::className);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -63,7 +63,7 @@ class SessionManagerTest extends BaseTestCase
|
||||
|
||||
public function testGetSessionKey()
|
||||
{
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::className);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -76,7 +76,7 @@ class SessionManagerTest extends BaseTestCase
|
||||
|
||||
public function testReleaseSessionKey()
|
||||
{
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::class);
|
||||
$clientManager = $this->createMock(JsonRpcClientManager::className);
|
||||
|
||||
$clientManager
|
||||
->expects(static::any())
|
||||
@@ -84,6 +84,6 @@ class SessionManagerTest extends BaseTestCase
|
||||
->willReturn([]);
|
||||
|
||||
$sessionManager = new SessionManager($clientManager);
|
||||
static::assertInstanceOf(SessionManager::class, $sessionManager->releaseSessionKey());
|
||||
static::assertInstanceOf(SessionManager::className, $sessionManager->releaseSessionKey());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user