You are here

private function JobsApiFunctionalTest::createJob in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/tests/functional/JobsApiFunctionalTest.php \Smartling\Tests\Functional\JobsApiFunctionalTest::createJob()

Create job.

Return value

string

1 call to JobsApiFunctionalTest::createJob()
JobsApiFunctionalTest::setUp in vendor/smartling/api-sdk-php/tests/functional/JobsApiFunctionalTest.php
Test mixture.

File

vendor/smartling/api-sdk-php/tests/functional/JobsApiFunctionalTest.php, line 83

Class

JobsApiFunctionalTest
Test class for Jobs API examples.

Namespace

Smartling\Tests\Functional

Code

private function createJob() {
  try {
    $params = new CreateJobParameters();
    $params
      ->setName('Test Job Name ' . time());
    $params
      ->setDescription('Test Job Description ' . time());
    $params
      ->setDueDate(DateTime::createFromFormat('Y-m-d H:i:s', '2020-01-01 19:19:17', new DateTimeZone('UTC')));
    $params
      ->setTargetLocales([
      'es',
      'fr',
    ]);
    $result = $this->jobsApi
      ->createJob($params);
    $this
      ->assertArrayHasKey('translationJobUid', $result);
    $this
      ->assertArrayHasKey('jobName', $result);
    $this
      ->assertArrayHasKey('targetLocaleIds', $result);
    $this
      ->assertArrayHasKey('description', $result);
    $this
      ->assertArrayHasKey('dueDate', $result);
    $this
      ->assertArrayHasKey('referenceNumber', $result);
    $this
      ->assertArrayHasKey('callbackUrl', $result);
    $this
      ->assertArrayHasKey('callbackMethod', $result);
    $this
      ->assertArrayHasKey('createdDate', $result);
    $this
      ->assertArrayHasKey('modifiedDate', $result);
    $this
      ->assertArrayHasKey('createdByUserUid', $result);
    $this
      ->assertArrayHasKey('modifiedByUserUid', $result);
    $this
      ->assertArrayHasKey('firstCompletedDate', $result);
    $this
      ->assertArrayHasKey('lastCompletedDate', $result);
    $this
      ->assertArrayHasKey('jobStatus', $result);
    $result = $result['translationJobUid'];
  } catch (SmartlingApiException $e) {
    $result = false;
  }
  return $result;
}