LingotekSystemSiteExistingBulkTranslationTest.php in Lingotek Translation 8.2
File
tests/src/Functional/LingotekSystemSiteExistingBulkTranslationTest.php
View source
<?php
namespace Drupal\Tests\lingotek\Functional;
use Drupal\language\Entity\ConfigurableLanguage;
class LingotekSystemSiteExistingBulkTranslationTest extends LingotekTestBase {
public static $modules = [
'block',
'node',
];
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this->rootUser);
$language = ConfigurableLanguage::createFromLangcode('es')
->setThirdPartySetting('lingotek', 'locale', 'es_MX');
$language
->save();
\Drupal::state()
->set('lingotek.uploaded_content_type', 'system.site');
$config = \Drupal::languageManager()
->getLanguageConfigOverride('es', 'system.site');
$config
->set('name', 'Translated Site Name')
->save();
}
public function testSystemSiteIsUntracked() {
$this
->goToConfigBulkManagementForm();
$basepath = \Drupal::request()
->getBasePath();
$this
->assertTargetStatus('ES', 'untracked');
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/upload/system.site_information_settings/system.site_information_settings?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->assertNoLinkByHref($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN', 1);
$this
->assertText(t('System information uploaded successfully'));
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
$this
->assertTargetStatus('ES', 'untracked');
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/check_upload/system.site_information_settings/system.site_information_settings?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN', 1);
$this
->assertText('System information status checked successfully');
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/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'));
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/check_download/system.site_information_settings/system.site_information_settings/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");
$this
->assertLinkByHref($basepath . '/admin/lingotek/config/download/system.site_information_settings/system.site_information_settings/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'));
$this
->assertLingotekWorkbenchLink('es_MX');
}
}