You are here

public function AuditLogApiTest::testCreateProjectLevelLogRecord in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/tests/unit/AuditLogApiTest.php \Smartling\Tests\Unit\AuditLogApiTest::testCreateProjectLevelLogRecord()

@covers \Smartling\AuditLog\AuditLogApi::createProjectLevelLogRecord

File

vendor/smartling/api-sdk-php/tests/unit/AuditLogApiTest.php, line 14

Class

AuditLogApiTest

Namespace

Smartling\Tests\Unit

Code

public function testCreateProjectLevelLogRecord() {
  $endpointUrl = vsprintf('%s/projects/%s/logs', [
    AuditLogApi::ENDPOINT_URL,
    $this->projectId,
  ]);
  $createParams = (new CreateRecordParameters())
    ->setActionTime(1234567890)
    ->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(1)
    ->setBatchUid("batch_uid")
    ->setDescription("description")
    ->setClientUserId("user_id")
    ->setClientUserEmail("user_email")
    ->setClientUserName("user_name")
    ->setEnvId("env_id")
    ->setClientData("foo", "bar")
    ->setClientData("foo1", "bar1");
  $this->client
    ->expects($this
    ->any())
    ->method('request')
    ->with('post', $endpointUrl, [
    'headers' => [
      'Accept' => 'application/json',
      'Authorization' => vsprintf('%s %s', [
        $this->authProvider
          ->getTokenType(),
        $this->authProvider
          ->getAccessToken(),
      ]),
    ],
    'exceptions' => false,
    'json' => [
      'actionTime' => '2009-02-13T23:31:30Z',
      'actionType' => CreateRecordParameters::ACTION_TYPE_UPLOAD,
      'fileUri' => 'file_uri',
      'fileUid' => 'file_uid',
      'sourceLocaleId' => 'en',
      'targetLocaleIds' => [
        'de',
      ],
      'translationJobUid' => 'smartling_job_uid',
      'translationJobName' => 'smartling_job_name',
      'translationJobDueDate' => 'smartling_job_due_date',
      'translationJobAuthorize' => true,
      'batchUid' => 'batch_uid',
      'description' => 'description',
      'clientUserId' => 'user_id',
      'clientUserEmail' => 'user_email',
      'clientUserName' => 'user_name',
      'envId' => 'env_id',
      'clientData' => [
        'foo' => 'bar',
        'foo1' => 'bar1',
      ],
    ],
  ])
    ->willReturn($this->responseMock);
  $this->object
    ->createProjectLevelLogRecord($createParams);
}