public function JobsApiTest::testCancelJob in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/JobsApiTest.php \Smartling\Tests\Unit\JobsApiTest::testCancelJob()
 
@covers \Smartling\Jobs\JobsApi::cancelJobSync
File
- vendor/
smartling/ api-sdk-php/ tests/ unit/ JobsApiTest.php, line 144  
Class
- JobsApiTest
 - Test class for Smartling\Jobs\JobsApi.
 
Namespace
Smartling\Tests\UnitCode
public function testCancelJob() {
  $jobId = 'Some job id';
  $reason = 'Some reason';
  $params = new CancelJobParameters();
  $params
    ->setReason($reason);
  $endpointUrl = vsprintf('%s/%s/jobs/%s/cancel', [
    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(),
      ]),
    ],
    'exceptions' => FALSE,
    'json' => [
      'reason' => $reason,
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->cancelJobSync($jobId, $params);
}