You are here

public function LingotekSystemSiteTranslationTest::testEditedSystemConfigTranslation in Lingotek Translation 4.0.x

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

Tests that a config can be translated after edited.

File

tests/src/Functional/LingotekSystemSiteTranslationTest.php, line 109

Class

LingotekSystemSiteTranslationTest
Tests translating a config object.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

  // We need a config with translations first.
  $this
    ->testSystemSiteTranslation();

  // 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();

  // Edit the config.
  $edit = [
    'site_name' => 'The Llamas site',
  ];
  $this
    ->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration');
  $this
    ->clickLink('Translate system information');

  // We need to reupload again. It's manual for configuration.
  $this
    ->clickLink('Upload');
  $this
    ->checkForMetaRefresh();

  // Ensure it has the expected timestamp for upload
  $timestamp = \Drupal::time()
    ->getRequestTime();
  foreach (LingotekConfigMetadata::loadMultiple() as $metadata) {
    $this
      ->assertEquals($timestamp, $metadata
      ->getLastUploaded());
    $this
      ->assertEquals($timestamp, $metadata
      ->getLastUpdated());
  }

  // Check the status is not edited for Vasque, but available to request
  // translation.
  $assert_session
    ->linkByHrefExists('admin/lingotek/config/request/system.site_information_settings/system.site_information_settings/eu_ES');

  // Recheck status.
  $this
    ->clickLink('Check Download');
  $this
    ->assertText('Translation to es_AR checked successfully');

  // Download the translation.
  $this
    ->clickLink('Download');
  $this
    ->assertText('Translation to es_AR downloaded successfully');
}