You are here

public function JobsApiTest::testAddLocaleToJob 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::testAddLocaleToJob()

@covers \Smartling\Jobs\JobsApi::addLocaleToJobSync

File

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

Class

JobsApiTest
Test class for Smartling\Jobs\JobsApi.

Namespace

Smartling\Tests\Unit

Code

public function testAddLocaleToJob() {
  $jobId = 'Some job id';
  $localeId = 'Some locale id';
  $params = new AddLocaleToJobParameters();
  $params
    ->setSyncContent(false);
  $endpointUrl = vsprintf('%s/%s/jobs/%s/locales/%s', [
    JobsApi::ENDPOINT_URL,
    $this->projectId,
    $jobId,
    $localeId,
  ]);
  $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' => [
      'syncContent' => false,
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->addLocaleToJobSync($jobId, $localeId, $params);
}