public function LingotekNodeTranslationTest::testEditedNodeTranslation in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 4.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.0.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.1.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.2.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.3.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.4.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.5.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 3.6.x tests/src/Functional/LingotekNodeTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslationTest::testEditedNodeTranslation()
- 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 312
Class
- LingotekNodeTranslationTest
- Tests translating a node.
Namespace
Drupal\Tests\lingotek\FunctionalCode
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);
// Assert the updated time and uploaded time are, in this case, equal
$this->node = $this
->resetStorageCachesAndReloadNode();
$metadata = $this->node->lingotek_metadata->entity;
$expected_time = \Drupal::time()
->getRequestTime();
$this
->assertEquals($expected_time, $metadata
->getLastUpdated());
$this
->assertEquals($expected_time, $metadata
->getLastUploaded());
$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');
}