public function ContextApiTest::testUploadResource in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.2 api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadResource()
- 8.2 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadResource()
- 8.3 vendor/smartling/api-sdk-php/tests/unit/ContextApiTest.php \Smartling\Tests\ContextApiTest::testUploadResource()
@covers \Smartling\Context\ContextApi::uploadResource
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ ContextApiTest.php, line 251
Class
- ContextApiTest
- Test class for Smartling\Context\ContextApi.
Namespace
Smartling\TestsCode
public function testUploadResource() {
$resourceId = 'some_resource_id';
$params = new UploadResourceParameters();
$params
->setFile('./tests/resources/test.png');
$endpointUrl = vsprintf('%s/%s/resources/%s', [
ContextApi::ENDPOINT_URL,
$this->projectId,
$resourceId,
]);
$this->client
->expects(self::once())
->method('request')
->with('put', $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' => 'resource',
'contents' => $this->streamPlaceholder,
],
],
])
->willReturn($this->responseMock);
$this->object
->uploadResource($resourceId, $params);
}