You are here

public function LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  2. 4.0.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  3. 3.0.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  4. 3.1.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  5. 3.2.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  6. 3.3.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  7. 3.4.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  8. 3.5.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  9. 3.6.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
  10. 3.7.x tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()

Tests that a config can be translated using the actions on the management page.

1 call to LingotekSystemSiteBulkTranslationTest::testSystemSiteTranslationUsingActions()
LingotekSystemSiteBulkTranslationTest::testDeleteTranslationUpdatesStatuses in tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php
Tests that we update the statuses when a translation is deleted.

File

tests/src/Functional/LingotekSystemSiteBulkTranslationTest.php, line 89

Class

LingotekSystemSiteBulkTranslationTest
Tests translating a config object using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testSystemSiteTranslationUsingActions() {
  $assert_session = $this
    ->assertSession();

  // Login as translation manager.
  $this
    ->drupalLogin($this->translationManagerUser);

  // Add a language.
  ConfigurableLanguage::createFromLangcode('de')
    ->setThirdPartySetting('lingotek', 'locale', 'de_AT')
    ->save();

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm();
  $basepath = \Drupal::request()
    ->getBasePath();

  // I can init the upload of content.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/system.site_information_settings/system.site_information_settings?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'upload',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('en_US', \Drupal::state()
    ->get('lingotek.uploaded_locale'));

  // I can check current status.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/system.site_information_settings/system.site_information_settings?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'check_upload',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Request the German (AT) translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'request_translation:de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.added_target_locale'));

  // Check status of the Spanish translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/system.site_information_settings/system.site_information_settings/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'check_translation:de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.checked_target_locale'));

  // Download the German translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/download/system.site_information_settings/system.site_information_settings/de_AT?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'download:de',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());
  $this
    ->assertIdentical('de_AT', \Drupal::state()
    ->get('lingotek.downloaded_locale'));

  // Now the link is to the workbench, and it opens in a new tab.
  $this
    ->assertLingotekWorkbenchLink('de_AT', 'dummy-document-hash-id', 'DE');
}