You are here

public function JobsApiTest::testAuthorizeJob in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/unit/JobsApiTest.php \Smartling\Tests\Unit\JobsApiTest::testAuthorizeJob()

@covers \Smartling\Jobs\JobsApi::authorizeJob

File

vendor/smartling/api-sdk-php/tests/unit/JobsApiTest.php, line 248

Class

JobsApiTest
Test class for Smartling\Jobs\JobsApi.

Namespace

Smartling\Tests\Unit

Code

public function testAuthorizeJob() {
  $jobId = 'Some job id';
  $endpointUrl = vsprintf('%s/%s/jobs/%s/authorize', [
    JobsApi::ENDPOINT_URL,
    $this->projectId,
    $jobId,
  ]);
  $this->client
    ->expects(self::once())
    ->method('request')
    ->with('post', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
      'Content-Type' => 'application/json',
    ],
    'exceptions' => FALSE,
    'json' => new \stdClass(),
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->authorizeJob($jobId);
}