You are here

class ProjectApiFunctionalTest in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/tests/functional/ProjectApiFunctionalTest.php \Smartling\Tests\Functional\ProjectApiFunctionalTest
  2. 8.2 vendor/smartling/api-sdk-php/tests/functional/ProjectApiFunctionalTest.php \Smartling\Tests\Functional\ProjectApiFunctionalTest
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/functional/ProjectApiFunctionalTest.php \Smartling\Tests\Functional\ProjectApiFunctionalTest
  2. 8.3 vendor/smartling/api-sdk-php/tests/functional/ProjectApiFunctionalTest.php \Smartling\Tests\Functional\ProjectApiFunctionalTest

Test class for Project API examples.

Hierarchy

Expanded class hierarchy of ProjectApiFunctionalTest

File

vendor/smartling/api-sdk-php/tests/functional/ProjectApiFunctionalTest.php, line 13

Namespace

Smartling\Tests\Functional
View source
class ProjectApiFunctionalTest extends PHPUnit_Framework_TestCase {

  /**
   * @var ProjectApi
   */
  private $projectApi;

  /**
   * Test mixture.
   */
  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->projectApi = ProjectApi::create($authProvider, $projectId);
  }

  /**
   * Test for project details.
   */
  public function testProjectDetails() {
    try {
      $result = $this->projectApi
        ->getProjectDetails();
      $this
        ->assertArrayHasKey('projectId', $result);
      $this
        ->assertArrayHasKey('projectName', $result);
      $this
        ->assertArrayHasKey('accountUid', $result);
      $this
        ->assertArrayHasKey('archived', $result);
      $this
        ->assertArrayHasKey('projectTypeCode', $result);
      $this
        ->assertArrayHasKey('projectTypeDisplayValue', $result);
      $this
        ->assertArrayHasKey('targetLocales', $result);
      $this
        ->assertArrayHasKey('sourceLocaleId', $result);
      $this
        ->assertArrayHasKey('sourceLocaleDescription', $result);
    } catch (SmartlingApiException $e) {
      $this
        ->fail($e
        ->getMessage());
    }
  }

}

Members