You are here

public function BaseFlowTest::testJobRejectionOnFileNotFoundExceptionWhileCheckingStatus in TMGMT Translator Smartling 8.3

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

File

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

Class

BaseFlowTest
Basic flow tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testJobRejectionOnFileNotFoundExceptionWhileCheckingStatus() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $translator = $this
      ->setUpSmartlingProviderSettings($this->smartlingPluginProviderSettings);
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $this
      ->assertEqual($job
      ->getState(), JobInterface::STATE_ACTIVE);
    $job->job_file_name = uniqid() . '_tmgmt_smartling_test_file_name.xml';
    $job
      ->save();
    $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.");
  }
}