You are here

public function LingotekSystemSiteBulkTranslationTest::testSystemSiteMultipleLanguageTranslationUsingActions in Lingotek Translation 8

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

File

src/Tests/LingotekSystemSiteBulkTranslationTest.php, line 211

Class

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

Namespace

Drupal\lingotek\Tests

Code

public function testSystemSiteMultipleLanguageTranslationUsingActions() {

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

  // 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.
  $this
    ->assertLinkByHref($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,
    // System information.
    'operation' => 'upload',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));

  // I can check current status.
  $this
    ->assertLinkByHref($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,
    // System information.
    'operation' => 'check_upload',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));

  // Request all the translations.
  $this
    ->assertLinkByHref($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,
    // System information.
    'operation' => 'request_translations',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));

  // Check status of all the translations.
  $this
    ->assertLinkByHref($basepath . '/admin/lingotek/config/check_download/system.site_information_settings/system.site_information_settings/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  $edit = [
    'table[system.site_information_settings]' => TRUE,
    // System information.
    'operation' => 'check_translations',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));

  // Download all the translations.
  $this
    ->assertLinkByHref($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,
    // System information.
    'operation' => 'download',
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Execute'));
}