You are here

public function JobsApiFunctionalTest::setUp 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::setUp()

Test mixture.

File

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

Class

JobsApiFunctionalTest
Test class for Jobs API examples.

Namespace

Smartling\Tests\Functional

Code

public function setUp() {
  $projectId = getenv('project_id');
  $userIdentifier = getenv('user_id');
  $userSecretKey = getenv('user_key');
  if (empty($projectId) || empty($userIdentifier) || empty($userSecretKey)) {
    $this
      ->fail('Missing required parameters');
  }
  $authProvider = AuthTokenProvider::create($userIdentifier, $userSecretKey);
  $this->jobsApi = JobsApi::create($authProvider, $projectId);
  $this->fileApi = FileApi::create($authProvider, $projectId);
  try {
    $this->jobId = $this
      ->createJob();
  } catch (SmartlingApiException $e) {
    $this
      ->fail($e
      ->getMessage());
  }
}