You are here

public function LingotekFieldBodyTranslationTest::testEditedFieldBodyTranslation in Lingotek Translation 3.6.x

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

Tests that a config can be translated after edited.

File

tests/src/Functional/LingotekFieldBodyTranslationTest.php, line 110

Class

LingotekFieldBodyTranslationTest
Tests translating a field.

Namespace

Drupal\Tests\lingotek\Functional

Code

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

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

  // 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 field.
  $edit = [
    'label' => 'Contents',
  ];
  $this
    ->drupalPostForm('/admin/structure/types/manage/article/fields/node.article.body', $edit, t('Save settings'));
  $this
    ->assertText('Saved Contents configuration.');
  $this
    ->clickLink(t('Translate'));

  // Check the status is not edited for Vasque, but available to request
  // translation.
  $assert_session
    ->linkByHrefExists('/admin/lingotek/config/request/node_fields/node.article.body/eu_ES');
  $assert_session
    ->linkByHrefNotExists('/admin/lingotek/config/request/node_fields/node.article.body/es_MX');

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

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