You are here

public function TranslationRequestManagerTest::testUpsertTranslationRequestCreateEmptyGetResponse in TMGMT Translator Smartling 8.4

Create translation request: empty response from get request.

File

tests/src/Kernel/TranslationRequestManagerTest.php, line 57

Class

TranslationRequestManagerTest
Tests TranslationRequestManagerTest class.

Namespace

Drupal\Tests\tmgmt_smartling\Kernel

Code

public function testUpsertTranslationRequestCreateEmptyGetResponse() {
  $translation_request_manager_mock = $this
    ->getMockBuilder(TranslationRequestManager::class)
    ->setConstructorArgs([
    $this->apiWrapperMock,
    $this->stateMock,
    $this->loggerMock,
  ])
    ->setMethods([
    'initApiWrapper',
    'getTranslationRequest',
    'isTranslationSubmissionMissed',
    'updateExistingTranslationRequest',
    'createNewTranslationRequest',
  ])
    ->getMock();
  $translation_request_manager_mock
    ->expects($this
    ->once())
    ->method('initApiWrapper')
    ->with($this->job);
  $translation_request_manager_mock
    ->expects($this
    ->once())
    ->method('getTranslationRequest')
    ->with($this->job)
    ->willReturn([]);
  $translation_request_manager_mock
    ->expects($this
    ->never())
    ->method('isTranslationSubmissionMissed');
  $translation_request_manager_mock
    ->expects($this
    ->once())
    ->method('createNewTranslationRequest')
    ->with($this->job);
  $translation_request_manager_mock
    ->expects($this
    ->never())
    ->method('updateExistingTranslationRequest');
  $translation_request_manager_mock
    ->upsertTranslationRequest($this->job);
}