You are here

public function BaseFlowTest::testJobRejectionOnLocaleNotFoundExceptionWhileCheckingStatus in TMGMT Translator Smartling 8.3

Test job rejection on "locale.not.found" exception while checking status.

File

tests/src/Functional/BaseFlowTest.php, line 160

Class

BaseFlowTest
Basic flow tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testJobRejectionOnLocaleNotFoundExceptionWhileCheckingStatus() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $translator = $this
      ->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);

    // Locale af-ZA isn't in test project's linguistic package so check status
    // for TMGMT Job submitted to af-ZA will throw exception locale.not.found.
    $translator
      ->set('remoteLanguages', [
      'af-ZA' => 'af-ZA',
    ]);
    $translator
      ->set('remote_languages_mappings', [
      'fr' => 'af-ZA',
    ]);
    $translator
      ->save();
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $this
      ->assertEqual($job
      ->getState(), JobInterface::STATE_ACTIVE);
    $job
      ->getTranslatorPlugin()
      ->isReadyForDownload($job);
    $job = Job::load($job
      ->id());
    $this
      ->assertEqual($job
      ->getState(), JobInterface::STATE_REJECTED);
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}