You are here

public function LingotekNodeTranslationTest::testEditedNodeTranslation in Lingotek Translation 3.1.x

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

Tests that a node can be translated after edited.

File

tests/src/Functional/LingotekNodeTranslationTest.php, line 273

Class

LingotekNodeTranslationTest
Tests translating a node.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testEditedNodeTranslation() {

  // We need a node with translations first.
  $this
    ->testNodeTranslation();

  // 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 node.
  $edit = [];
  $edit['title[0][value]'] = 'Llamas are cool EDITED';
  $edit['body[0][value]'] = 'Llamas are very cool EDITED';
  $edit['langcode[0][value]'] = 'en';
  $edit['lingotek_translation_management[lingotek_translation_profile]'] = 'automatic';
  $this
    ->saveAndKeepPublishedThisTranslationNodeForm($edit, 1);
  $this
    ->clickLink('Translate');

  // Check the status is not edited for Vasque, but available to request
  // translation.
  $this
    ->assertLingotekRequestTranslationLink('eu_ES', 'dummy-document-hash-id-1');
  $this
    ->assertNoLingotekRequestTranslationLink('es_MX', 'dummy-document-hash-id-1');

  // Recheck status.
  $this
    ->clickLink('Check translation status');
  $this
    ->assertText('The es_MX translation for node Llamas are cool EDITED is ready for download.');

  // Download the translation.
  $this
    ->clickLink('Download completed translation');
  $this
    ->assertText('The translation of node Llamas are cool EDITED into es_MX has been downloaded.');
  $this
    ->clickLink('Las llamas son chulas');
  $this
    ->assertText('Las llamas son muy chulas');
}