/**
  * @covers SmartlingAPI::getCodeStatus
  */
 public function testGetCodeStatus()
 {
     $this->invokeMethod($this->object, 'sendRequest', array('', array(), 'POST'));
     //check response type
     $this->assertInternalType('string', $this->object->getCodeStatus());
     //not equals false
     $this->assertNotEquals(false, $this->object->getCodeStatus());
 }
Ejemplo n.º 2
0
include_once 'lib/SmartlingAPI.php';
$key = "";
$projectId = "";
$baseUrl = 'https://api.smartling.com/v1';
$fileUri = 'testing.xml';
$fileType = 'xml';
$newFileUri = 'newfile.xml';
$fileName = 'translated.xml';
$content = file_get_contents(realpath('./test.xml'));
$fileContentUri = "testing_content.xml";
$translationState = 'PUBLISHED';
$locale = 'ru-RU';
$locales_array = array('ru-RU');
//init api object
$api = new SmartlingAPI($baseUrl, $key, $projectId);
$upload_params = new FileUploadParameterBuilder();
$upload_params->setFileUri($fileUri)->setFileType($fileType)->setLocalesToApprove($locales_array)->setOverwriteApprovedLocales(0)->setApproved(0)->setCallbackUrl('http://test.com/smartling');
$upload_params = $upload_params->buildParameters();
//try to upload file
$result = $api->uploadFile('./test.xml', $upload_params);
var_dump($result);
echo "<br />This is a upload file<br />";
//try to upload content
$result = $api->uploadContent($content, $upload_params);
var_dump($result);
echo "<br />This is a upload content<br />";
//try to download file
$result = $api->downloadFile($fileUri, $locale);
var_dump($result);
echo "<br />This is a download file<br />";