public function TranslationRequestsApiTest::testGetTranslationRequest 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::testGetTranslationRequest()
@covers \Smartling\TranslationRequests\TranslationRequestsApi::getTranslationRequest
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ TranslationRequestsApiTest.php, line 195
Class
Namespace
Smartling\Tests\UnitCode
public function testGetTranslationRequest() {
$translationRequestUid = '8264fd9133d3';
$testRawResponse = json_encode([
"response" => [
"code" => "SUCCESS",
"data" => [
"translationRequestUid" => $translationRequestUid,
"projectId" => $this->projectId,
"bucketName" => "name",
"originalAssetId" => [
"a" => "1",
],
"title" => "Submission 2",
"fileUri" => "/posts/hello-world_1_1_post.xml",
"totalWordCount" => "0",
"totalStringCount" => "0",
"contentHash" => null,
"originalLocaleId" => "en-US",
"outdated" => "0",
"customOriginalData" => null,
"createdDate" => "2018-07-31T10:37:20.839Z",
"modifiedDate" => "2018-07-31T10:37:20.839Z",
"translationSubmissions" => [],
],
],
]);
$this
->mockClientResponse(200, $testRawResponse);
$testExpectedResponse = json_decode($testRawResponse, true)['response']['data'];
$bucketName = 'name';
$endpointUrl = vsprintf('%s/%s/buckets/%s/translation-requests/%s', [
TranslationRequestsApi::ENDPOINT_URL,
$this->projectId,
$bucketName,
$translationRequestUid,
]);
$requestStructure = [
'headers' => [
'Accept' => 'application/json',
'Authorization' => vsprintf('%s %s', [
$this->authProvider
->getTokenType(),
$this->authProvider
->getAccessToken(),
]),
],
'exceptions' => false,
'query' => [],
];
$this->client
->expects(self::once())
->method('request')
->with('get', $endpointUrl, $requestStructure)
->willReturn($this->responseMock);
$response = $this->object
->getTranslationRequest($bucketName, $translationRequestUid);
self::assertEquals($testExpectedResponse, $response);
}