You are here

public function RevisionInflationTest::testRevisionInflationAutoAcceptFinishedTranslationsIsDisabled in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/RevisionInflationTest.php \Drupal\Tests\tmgmt_smartling\Functional\RevisionInflationTest::testRevisionInflationAutoAcceptFinishedTranslationsIsDisabled()

Test revision inflation with disabled "Auto accept finished translations".

File

tests/src/Functional/RevisionInflationTest.php, line 169

Class

RevisionInflationTest
Revision inflation tests.

Namespace

Drupal\Tests\tmgmt_smartling\Functional

Code

public function testRevisionInflationAutoAcceptFinishedTranslationsIsDisabled() {
  if (!empty($this->smartlingPluginProviderSettings)) {
    $providerSettings = $this->smartlingPluginProviderSettings;
    $providerSettings['auto_accept'] = FALSE;
    $translator = $this
      ->setUpSmartlingProviderSettings($providerSettings);
    $job = $this
      ->requestTranslationForNode($this->testNodeId, $this->targetLanguage, $translator);
    $this
      ->drupalGet("/admin/tmgmt/jobs/1");
    $this
      ->assertResponse(200);
    $this
      ->assertNoText("is finished and can now be reviewed.");
    $this
      ->assertNoText("Import of downloaded file was skipped: downloaded and existing translations are equal.");
    $job
      ->getTranslatorPlugin()
      ->downloadTranslation($job);
    $this
      ->drupalGet("/admin/tmgmt/jobs/1");
    $this
      ->assertResponse(200);
    $this
      ->assertText("is finished and can now be reviewed.");
    $this
      ->assertNoText("Import of downloaded file was skipped: downloaded and existing translations are equal.");
    foreach ($job
      ->getItems() as $item) {
      $item
        ->acceptTranslation();
    }
    $job
      ->getTranslatorPlugin()
      ->downloadTranslation($job);
    $this
      ->drupalGet("/admin/tmgmt/jobs/1");
    $this
      ->assertResponse(200);
    $this
      ->assertText("Import of downloaded file was skipped: downloaded and existing translations are equal.");
    $this
      ->drupalGet("/admin/tmgmt/jobs/1");
  }
  else {
    $this
      ->fail("Smartling settings file for simpletests not found.");
  }
}