public function ContextApiTest::testUploadAndMatchContext in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadAndMatchContext()
- 8.2 api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadAndMatchContext()
- 8.2 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadAndMatchContext()
@covers \Smartling\Context\ContextApi::uploadAndMatchContext
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ ContextApiTest.php, line 136
Class
- ContextApiTest
- Test class for Smartling\Context\ContextApi.
Namespace
Smartling\TestsCode
public function testUploadAndMatchContext() {
$fileUri = './tests/resources/context.html';
$matchParams = new MatchContextParameters();
$matchParams
->setContentFileUri($fileUri);
$params = new UploadContextParameters();
$params
->setContent($fileUri);
$params
->setMatchParams($matchParams);
$endpointUrl = vsprintf('%s/%s/contexts/upload-and-match-async', [
ContextApi::ENDPOINT_URL,
$this->projectId,
]);
$this->client
->expects(self::once())
->method('request')
->with('post', $endpointUrl, [
'headers' => [
'Accept' => 'application/json',
'Authorization' => vsprintf('%s %s', [
$this->authProvider
->getTokenType(),
$this->authProvider
->getAccessToken(),
]),
'X-SL-Context-Source' => $this
->invokeMethod($this->object, 'getXSLContextSourceHeader'),
],
'exceptions' => FALSE,
'multipart' => [
[
'name' => 'content',
'contents' => $this->streamPlaceholder,
],
[
'name' => 'matchParams',
'contents' => '{"contentFileUri":".\\/tests\\/resources\\/context.html"}',
'headers' => [
'Content-Type' => 'application/json',
],
],
],
])
->willReturn($this->responseMock);
$this->object
->uploadAndMatchContext($params);
}