public function LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 4.0.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.0.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.1.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.2.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.3.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.4.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.5.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.6.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
- 3.8.x tests/src/Functional/LingotekNodeStatusDownloadTargetTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeStatusDownloadTargetTest::testNodeSourceStatusUponTargetDownload()
Tests that a node can be translated.
File
- tests/
src/ Functional/ LingotekNodeStatusDownloadTargetTest.php, line 55
Class
- LingotekNodeStatusDownloadTargetTest
- Tests translating a node.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testNodeSourceStatusUponTargetDownload() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Create a node.
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->saveAndPublishNodeForm($edit);
$this
->goToContentBulkManagementForm();
// Clicking English must init the upload of content.
$this
->assertLingotekUploadLink();
// And we cannot request yet a translation.
$this
->assertNoLingotekRequestTranslationLink('es_MX');
$this
->clickLink('EN');
$this
->assertText('Node Llamas are cool has been uploaded.');
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// There is a link for checking status.
$this
->assertLingotekCheckSourceStatusLink();
// And we can already request a translation.
$this
->assertLingotekRequestTranslationLink('es_MX');
$this
->clickLink('EN');
$this
->assertText('The import for node Llamas are cool is complete.');
// Request the Spanish translation.
$this
->assertLingotekRequestTranslationLink('es_MX');
$this
->clickLink('ES');
$this
->assertText("Locale 'es_MX' was added as a translation target for node Llamas are cool.");
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.added_target_locale'));
// Check status of the Spanish translation.
$this
->assertLingotekCheckTargetStatusLink('es_MX');
$this
->clickLink('ES');
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.checked_target_locale'));
$this
->assertText('The es_MX translation for node Llamas are cool is ready for download.');
// Edit the Source
$edit = [];
$edit['title[0][value]'] = 'Llamas are cool EDITED';
$this
->saveAndKeepPublishedNodeForm($edit, 1);
$this
->goToContentBulkManagementForm();
$this
->assertSourceStatus('EN', Lingotek::STATUS_EDITED);
// Check that the Spanish translation is still 'Ready'.
$this
->assertTargetStatus('ES', Lingotek::STATUS_READY);
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCheckTranslations('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// Check that the Spanish translation is still 'Ready'.
$this
->assertTargetStatus('ES', Lingotek::STATUS_READY);
// Download the Spanish translation.
$key = $this
->getBulkSelectionKey('en', 1);
$edit = [
$key => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForDownloadTranslations('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// Check the status is not Current for source.
$source_edited = $this
->xpath("//span[contains(@class,'language-icon') and contains(@class, 'source-edited') and contains(@title, 'Re-upload (content has changed since last upload)')]");
$this
->assertEqual(count($source_edited), 1, 'Source is marked as edited.');
$this
->assertTargetStatus('ES', Lingotek::STATUS_EDITED);
}