ProjectApiTest.php in TMGMT Translator Smartling 8.4
File
vendor/smartling/api-sdk-php/tests/unit/ProjectApiTest.php
View source
<?php
namespace Smartling\Tests\Unit;
use Smartling\Project\ProjectApi;
class ProjectApiTest extends ApiTestAbstract {
public function testGetProjectDetails() {
$endpointUrl = vsprintf('%s/%s/', [
ProjectApi::ENDPOINT_URL,
$this->projectId,
]);
$this->client
->expects($this
->any())
->method('request')
->with('get', $endpointUrl, [
'headers' => [
'Accept' => 'application/json',
'Authorization' => vsprintf('%s %s', [
$this->authProvider
->getTokenType(),
$this->authProvider
->getAccessToken(),
]),
],
'exceptions' => false,
'query' => [],
])
->willReturn($this->responseMock);
$this->object
->getProjectDetails();
}
protected function setUp() {
parent::setUp();
$this
->prepareProjectApiMock();
}
private function prepareProjectApiMock() {
$this->object = $this
->getMockBuilder('Smartling\\Project\\ProjectApi')
->setMethods(NULL)
->setConstructorArgs([
$this->projectId,
$this->client,
null,
ProjectApi::ENDPOINT_URL,
])
->getMock();
$this
->invokeMethod($this->object, 'setAuth', [
$this->authProvider,
]);
}
}