You are here

public function LingotekUserSettingsBulkTranslationTest::testUserSettingsTranslationUsingLinks in Lingotek Translation 3.5.x

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

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

2 calls to LingotekUserSettingsBulkTranslationTest::testUserSettingsTranslationUsingLinks()
LingotekUserSettingsBulkTranslationTest::testAddingLanguageAllowsRequesting in tests/src/Functional/LingotekUserSettingsBulkTranslationTest.php
Tests that a config can be translated using the links on the management page.
LingotekUserSettingsBulkTranslationTest::testEditedConfigTranslationUsingLinks in tests/src/Functional/LingotekUserSettingsBulkTranslationTest.php
Tests that a config can be translated using the links on the management page.

File

tests/src/Functional/LingotekUserSettingsBulkTranslationTest.php, line 36

Class

LingotekUserSettingsBulkTranslationTest
Tests translating user settings using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

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

  // Clicking English must init the upload of content.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/entity.user.admin_form/entity.user.admin_form?destination=' . $basepath . '/admin/lingotek/config/manage');

  // And we cannot request yet a translation.
  $assert_session
    ->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/entity.user.admin_form/entity.user.admin_form/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('EN', 3);
  $this
    ->assertText(t('Account settings uploaded successfully'));
  $this
    ->assertIdentical('en_US', \Drupal::state()
    ->get('lingotek.uploaded_locale'));
  $this
    ->verbose(var_export(\Drupal::state()
    ->get('lingotek.uploaded_content'), TRUE));

  // There is a link for checking status.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/entity.user.admin_form/entity.user.admin_form?destination=' . $basepath . '/admin/lingotek/config/manage');

  // And we can already request a translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/entity.user.admin_form/entity.user.admin_form/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('EN', 3);
  $this
    ->assertText('Account settings status checked successfully');

  // Request the Spanish translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/entity.user.admin_form/entity.user.admin_form/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertText("Translation to es_MX requested successfully");
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.added_target_locale'));

  // Check status of the Spanish translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/entity.user.admin_form/entity.user.admin_form/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.checked_target_locale'));
  $this
    ->assertText("Translation to es_MX checked successfully");

  // Download the Spanish translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/download/entity.user.admin_form/entity.user.admin_form/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $this
    ->clickLink('ES');
  $this
    ->assertText('Translation to es_MX downloaded successfully');
  $this
    ->assertIdentical('es_MX', \Drupal::state()
    ->get('lingotek.downloaded_locale'));

  // Now the link is to the workbench, and it opens in a new tab.
  $this
    ->assertLingotekWorkbenchLink('es_MX');
}