public function LingotekSystemSiteBulkTranslationTest::testEditedConfigTranslationUsingLinks in Lingotek Translation 8
Tests that a config can be translated using the links on the management page.
File
- src/
Tests/ LingotekSystemSiteBulkTranslationTest.php, line 149
Class
- LingotekSystemSiteBulkTranslationTest
- Tests translating a config object using the bulk management form.
Namespace
Drupal\lingotek\TestsCode
public function testEditedConfigTranslationUsingLinks() {
// We need a config object with translations first.
$this
->testSystemSiteTranslationUsingLinks();
// Add a language so we can check that it's not marked as dirty if there are
// no translations.
ConfigurableLanguage::createFromLangcode('eu')
->setThirdPartySetting('lingotek', 'locale', 'eu_ES')
->save();
// Add a language so we can check that it's not marked as for requesting if
// it was already requested.
ConfigurableLanguage::createFromLangcode('ko')
->setThirdPartySetting('lingotek', 'locale', 'ko_KR')
->save();
// Edit the object
$this
->drupalPostForm('/admin/config/system/site-information', [
'site_name' => 'My site',
], t('Save configuration'));
// Go to the bulk config management page.
$this
->goToConfigBulkManagementForm();
// Check the status is edited for Spanish.
$untracked = $this
->xpath("//a[contains(@class,'language-icon') and contains(@class, 'target-edited') and contains(text(), 'ES')]");
$this
->assertEqual(count($untracked), 1, 'Edited translation is shown.');
// Check the status is not edited for Vasque, but available to request
// translation.
$eu_edited = $this
->xpath("//a[contains(@class,'language-icon') and contains(@class, 'target-edited') and contains(text(), 'EU')]");
$this
->assertEqual(count($eu_edited), 0, 'Vasque is not marked as edited.');
$eu_request = $this
->xpath("//a[contains(@class,'language-icon') and contains(@class, 'target-request') and contains(text(), 'EU')]");
$this
->assertEqual(count($eu_request), 1, 'Vasque is ready for request.');
// Request korean, with outdated content available.
$this
->clickLink('KO');
$this
->assertText("Translation to ko_KR requested successfully");
// Reupload the content.
$this
->clickLink('EN', 1);
$this
->assertText('System information has been updated.');
// Korean should be marked as requested, so we can check target.
$status = $this
->xpath("//a[contains(@class,'language-icon') and contains(@class, 'target-pending') and contains(text(), 'KO')]");
$this
->assertEqual(count($status), 1, 'Korean is requested, so we can still check the progress status of the translation');
// Recheck status.
$this
->clickLink('EN', 1);
$this
->assertText('System information status checked successfully');
// Check the translation after having been edited.
// Check status of the Spanish translation.
$edit = [
'table[system.site_information_settings]' => TRUE,
// System information.
'operation' => 'check_translation:es',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
$this
->assertText('Operations completed.');
// Download the translation.
$this
->clickLink('ES');
$this
->assertText('Translation to es_MX downloaded successfully');
}