You are here

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

@covers \Smartling\Jobs\JobsApi::listJobs

File

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

Class

JobsApiTest
Test class for Smartling\Jobs\JobsApi.

Namespace

Smartling\Tests\Unit

Code

public function testListJobs() {
  $name = 'Test Job Name Updated';
  $limit = 1;
  $offset = 2;
  $params = new ListJobsParameters();
  $params
    ->setName($name);
  $params
    ->setLimit($limit);
  $params
    ->setOffset($offset);
  $endpointUrl = vsprintf('%s/%s/jobs', [
    JobsApi::ENDPOINT_URL,
    $this->projectId,
  ]);
  $this->client
    ->expects(self::once())
    ->method('request')
    ->with('get', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
    ],
    'exceptions' => FALSE,
    'query' => [
      'jobName' => $name,
      'limit' => $limit,
      'offset' => $offset,
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->listJobs($params);
}