You are here

public function UploadFlowTest::testRequestTranslationFailFlowNoBatchUid in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/UploadFlowTest.php \Drupal\Tests\tmgmt_smartling\Kernel\UploadFlowTest::testRequestTranslationFailFlowNoBatchUid()

Upload fail flow: no batch uid.

File

tests/src/Kernel/UploadFlowTest.php, line 174

Class

UploadFlowTest
Tests file upload flow.

Namespace

Drupal\Tests\tmgmt_smartling\Kernel

Code

public function testRequestTranslationFailFlowNoBatchUid() {
  $this->translationRequestManagerMock
    ->expects($this
    ->never())
    ->method('upsertTranslationRequest');
  $this->translationRequestManagerMock
    ->expects($this
    ->never())
    ->method('commitError');
  $translate_job = $this
    ->createJobWithItems([]);
  $this->apiWrapperMock
    ->expects($this
    ->once())
    ->method('createAuditLogRecord')
    ->with($translate_job, NULL, \Drupal::currentUser(), CreateRecordParameters::ACTION_TYPE_UPLOAD);
  $this->apiWrapperMock
    ->expects($this
    ->never())
    ->method('getApi');
  $this->batchApiMock
    ->expects($this
    ->never())
    ->method('uploadBatchFile');
  $this->apiWrapperMock
    ->expects($this
    ->never())
    ->method('executeBatch');
  $this->translationRequestManagerMock
    ->expects($this
    ->never())
    ->method('commitSuccessfulUpload');
  $this->apiWrapperMock
    ->expects($this
    ->once())
    ->method('createFirebaseRecord')
    ->with('tmgmt_smartling', 'notifications', 10, [
    "message" => "File JobID1_en_de.xml (job id = 1) wasn't uploaded. Please see logs for more info.",
    "type" => "error",
  ]);
  $translate_job
    ->requestTranslation();
}