mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 02:11:45 +01:00
ParticipantService & SurveyService - allow to get a client from these services (add getters)
This commit is contained in:
@@ -53,6 +53,16 @@ class ParticipantService
|
|||||||
$this->allParticipants = $allParticipants;
|
$this->allParticipants = $allParticipants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns client of the LimeSurvey's API
|
||||||
|
*
|
||||||
|
* @return Client
|
||||||
|
*/
|
||||||
|
public function getClient()
|
||||||
|
{
|
||||||
|
return $this->client;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns participants of given survey
|
* Returns participants of given survey
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -51,6 +51,16 @@ class SurveyService
|
|||||||
$this->allSurveys = $allSurveys;
|
$this->allSurveys = $allSurveys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns client of the LimeSurvey's API
|
||||||
|
*
|
||||||
|
* @return Client
|
||||||
|
*/
|
||||||
|
public function getClient()
|
||||||
|
{
|
||||||
|
return $this->client;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all surveys
|
* Returns all surveys
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -49,6 +49,24 @@ class ParticipantServiceTest extends BaseTestCase
|
|||||||
static::assertConstructorVisibilityAndArguments(ParticipantService::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
static::assertConstructorVisibilityAndArguments(ParticipantService::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetClient()
|
||||||
|
{
|
||||||
|
$rpcClientManager = $this->getJsonRpcClientManager(0);
|
||||||
|
$sessionManager = $this->getSessionManager();
|
||||||
|
|
||||||
|
$this->createServiceWithoutParticipants($rpcClientManager, $sessionManager);
|
||||||
|
$this->createServiceWithParticipants($rpcClientManager, $sessionManager);
|
||||||
|
|
||||||
|
static::assertInstanceOf(Client::class, $this->serviceWithoutParticipants->getClient());
|
||||||
|
static::assertInstanceOf(Client::class, $this->serviceWithParticipants->getClient());
|
||||||
|
|
||||||
|
$connectionConfiguration = new ConnectionConfiguration('http://test.com', 'test', 'test');
|
||||||
|
$client = new Client($connectionConfiguration);
|
||||||
|
$participantService = new ParticipantService($client);
|
||||||
|
|
||||||
|
static::assertEquals($client, $participantService->getClient());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetSurveyParticipantsFromEmptyParticipants()
|
public function testGetSurveyParticipantsFromEmptyParticipants()
|
||||||
{
|
{
|
||||||
$rpcClientManager = $this->getJsonRpcClientManager(3);
|
$rpcClientManager = $this->getJsonRpcClientManager(3);
|
||||||
|
|||||||
@@ -48,6 +48,24 @@ class SurveyServiceTest extends BaseTestCase
|
|||||||
static::assertConstructorVisibilityAndArguments(SurveyService::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
static::assertConstructorVisibilityAndArguments(SurveyService::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetClient()
|
||||||
|
{
|
||||||
|
$rpcClientManager = $this->getJsonRpcClientManager(0);
|
||||||
|
$sessionManager = $this->getSessionManager();
|
||||||
|
|
||||||
|
$this->createServiceWithoutSurveys($rpcClientManager, $sessionManager);
|
||||||
|
$this->createServiceWithSurveys($rpcClientManager, $sessionManager);
|
||||||
|
|
||||||
|
static::assertInstanceOf(Client::class, $this->serviceWithoutSurveys->getClient());
|
||||||
|
static::assertInstanceOf(Client::class, $this->serviceWithSurveys->getClient());
|
||||||
|
|
||||||
|
$connectionConfiguration = new ConnectionConfiguration('http://test.com', 'test', 'test');
|
||||||
|
$client = new Client($connectionConfiguration);
|
||||||
|
$surveyService = new SurveyService($client);
|
||||||
|
|
||||||
|
static::assertEquals($client, $surveyService->getClient());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetAllSurveys()
|
public function testGetAllSurveys()
|
||||||
{
|
{
|
||||||
$rpcClientManager = $this->getJsonRpcClientManager(1);
|
$rpcClientManager = $this->getJsonRpcClientManager(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user