You are here

public function TranslationRequestManagerTest::testGetTranslationRequest in TMGMT Translator Smartling 8.4

Get request test.

File

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

Class

TranslationRequestManagerTest
Tests TranslationRequestManagerTest class.

Namespace

Drupal\Tests\tmgmt_smartling\Kernel

Code

public function testGetTranslationRequest() {
  $asset_key = [
    'tmgmt_job_id' => $this->job
      ->id(),
  ];
  $search_params = new SearchTranslationRequestParams();
  $search_params
    ->setOriginalAssetKey($asset_key);
  $search_params
    ->setTargetAssetKey($asset_key);
  $search_params
    ->setTargetLocaleId($this->job
    ->getRemoteTargetLanguage());
  $search_params
    ->setLimit(1);
  $translation_request_manager_mock = $this
    ->getMockBuilder(TranslationRequestManager::class)
    ->setConstructorArgs([
    $this->apiWrapperMock,
    $this->stateMock,
    $this->loggerMock,
  ])
    ->setMethods([
    'initApiWrapper',
  ])
    ->getMock();
  $translation_request_manager_mock
    ->expects($this
    ->once())
    ->method('initApiWrapper')
    ->with($this->job);
  $this->apiWrapperMock
    ->expects($this
    ->once())
    ->method('searchTranslationRequest')
    ->with('tmgmt_smartling_bucket', $search_params);
  $translation_request_manager_mock
    ->getTranslationRequest($this->job);
}