You are here

public function JobsApiTest::testSearchJobs in TMGMT Translator Smartling 8.4

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

@covers \Smartling\Jobs\JobsApi::searchJobs

File

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

Class

JobsApiTest
Test class for Smartling\Jobs\JobsApi.

Namespace

Smartling\Tests\Unit

Code

public function testSearchJobs() {
  $fileToSearch = 'some_file_to_search.xml';
  $params = new SearchJobsParameters();
  $params
    ->setFileUris([
    $fileToSearch,
  ]);
  $endpointUrl = vsprintf('%s/%s/jobs/search', [
    JobsApi::ENDPOINT_URL,
    $this->projectId,
  ]);
  $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' => [
      'fileUris' => [
        $fileToSearch,
      ],
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->searchJobs($params);
}