You are here

public function BaseFlowTest::testJobRejectionOnLocaleDisabledExceptionWhileCheckingStatus in TMGMT Translator Smartling 8.3

Test job rejection on "locale.disabled" exception while checking status.

File

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

Class

BaseFlowTest
Basic flow tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

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

    // Locale fr-CA is in test project's linguistic package but disabled in
    // smartling project so check status for TMGMT Job submitted to fr-CA will
    // throw exception locale.disabled.
    $translator
      ->set('remoteLanguages', [
      'fr-CA' => 'fr-CA',
    ]);
    $translator
      ->set('remote_languages_mappings', [
      'fr' => 'fr-CA',
    ]);
    $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.");
  }
}