public function AuditLogApiFunctionalTest::testSearchProjectLevelLogRecord in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 vendor/smartling/api-sdk-php/tests/functional/AuditLogApiFunctionalTest.php \Smartling\Tests\Functional\AuditLogApiFunctionalTest::testSearchProjectLevelLogRecord()
File
- vendor/
smartling/ api-sdk-php/ tests/ functional/ AuditLogApiFunctionalTest.php, line 107
Class
Namespace
Smartling\Tests\FunctionalCode
public function testSearchProjectLevelLogRecord() {
try {
$user_id = uniqid();
$time = time();
$createParams = (new CreateRecordParameters())
->setActionTime($time)
->setActionType(CreateRecordParameters::ACTION_TYPE_UPLOAD)
->setFileUri("file_uri")
->setFileUid("file_uid")
->setSourceLocaleId('en')
->setTargetLocaleIds([
'de',
])
->setTranslationJobUid("smartling_job_uid")
->setTranslationJobName("smartling_job_name")
->setTranslationJobDueDate("smartling_job_due_date")
->setTranslationJobAuthorize(true)
->setBatchUid("batch_uid")
->setDescription("description")
->setClientUserId($user_id)
->setClientUserEmail("user_email")
->setClientUserName("user_name")
->setEnvId("env_id")
->setClientData("foo", "bar")
->setClientData("foo1", "bar1");
$createParamsArray = $createParams
->exportToArray();
$this->auditLogApi
->createProjectLevelLogRecord($createParams);
sleep(1);
$params = (new SearchRecordParameters())
->setSearchQuery("clientUserId:{$user_id}");
$result = $this->auditLogApi
->searchProjectLevelLogRecord($params);
$this
->assertArrayHasKey('totalCount', $result);
$this
->assertArrayHasKey('items', $result);
$this
->assertEquals($result['totalCount'], 1);
$this
->assertEquals(count($result['items']), 1);
$this
->assertEquals($result['items'][0]['actionTime'], $createParamsArray['actionTime']);
$this
->assertEquals($result['items'][0]['actionType'], $createParamsArray['actionType']);
$this
->assertEquals($result['items'][0]['fileUri'], $createParamsArray['fileUri']);
$this
->assertEquals($result['items'][0]['fileUid'], $createParamsArray['fileUid']);
$this
->assertEquals($result['items'][0]['sourceLocaleId'], $createParamsArray['sourceLocaleId']);
$this
->assertEquals($result['items'][0]['targetLocaleIds'], $createParamsArray['targetLocaleIds']);
$this
->assertEquals($result['items'][0]['translationJobUid'], $createParamsArray['translationJobUid']);
$this
->assertEquals($result['items'][0]['translationJobName'], $createParamsArray['translationJobName']);
$this
->assertEquals($result['items'][0]['translationJobDueDate'], $createParamsArray['translationJobDueDate']);
$this
->assertEquals($result['items'][0]['translationJobAuthorize'], $createParamsArray['translationJobAuthorize']);
$this
->assertEquals($result['items'][0]['batchUid'], $createParamsArray['batchUid']);
$this
->assertEquals($result['items'][0]['description'], $createParamsArray['description']);
$this
->assertEquals($result['items'][0]['clientUserId'], $createParamsArray['clientUserId']);
$this
->assertEquals($result['items'][0]['clientUserEmail'], $createParamsArray['clientUserEmail']);
$this
->assertEquals($result['items'][0]['clientUserName'], $createParamsArray['clientUserName']);
$this
->assertEquals($result['items'][0]['envId'], $createParamsArray['envId']);
$this
->assertEquals($result['items'][0]['clientData'], $createParamsArray['clientData']);
$this
->assertEquals($result['items'][0]['accountUid'], getenv("account_uid"));
$this
->assertEquals($result['items'][0]['projectUid'], getenv('project_id'));
} catch (SmartlingApiException $e) {
$result = false;
}
return $result;
}