ProjectApiFunctionalTest.php in TMGMT Translator Smartling 8.2
File
vendor/smartling/api-sdk-php/tests/functional/ProjectApiFunctionalTest.php
View source
<?php
namespace Smartling\Tests\Functional;
use PHPUnit_Framework_TestCase;
use Smartling\AuthApi\AuthTokenProvider;
use Smartling\Exceptions\SmartlingApiException;
use Smartling\Project\ProjectApi;
class ProjectApiFunctionalTest extends PHPUnit_Framework_TestCase {
private $projectApi;
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);
}
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());
}
}
}