public function TranslationRequestsApiTest::testSearchTranslationRequests in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 vendor/smartling/api-sdk-php/tests/unit/TranslationRequestsApiTest.php \Smartling\Tests\Unit\TranslationRequestsApiTest::testSearchTranslationRequests()
@covers \Smartling\TranslationRequests\TranslationRequestsApi::searchTranslationRequests @dataProvider searchTranslationRequestTestDataProvider
Parameters
SearchTranslationRequestParams $searchParams:
array $queryParams:
array $rawResponse:
Throws
\Smartling\Exceptions\InvalidAccessTokenException
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ TranslationRequestsApiTest.php, line 397
Class
Namespace
Smartling\Tests\UnitCode
public function testSearchTranslationRequests(SearchTranslationRequestParams $searchParams, array $queryParams, array $rawResponse) {
$testRawResponse = json_encode($rawResponse);
$this
->mockClientResponse(200, $testRawResponse);
$testExpectedResponse = $rawResponse['response']['data'];
$bucketName = 'name';
$endpointUrl = vsprintf('%s/%s/buckets/%s/translation-requests', [
TranslationRequestsApi::ENDPOINT_URL,
$this->projectId,
$bucketName,
]);
$requestStructure = [
'headers' => [
'Accept' => 'application/json',
'Authorization' => vsprintf('%s %s', [
$this->authProvider
->getTokenType(),
$this->authProvider
->getAccessToken(),
]),
],
'exceptions' => false,
'query' => $queryParams,
];
$this->client
->expects(self::once())
->method('request')
->with('get', $endpointUrl, $requestStructure)
->willReturn($this->responseMock);
$response = $this->object
->searchTranslationRequests($bucketName, $searchParams);
self::assertEquals($testExpectedResponse, $response);
}