public function LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.0.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.1.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.2.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.3.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.4.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.5.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.6.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.7.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
- 3.8.x tests/src/Functional/LingotekNodeManageTranslationTabTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeManageTranslationTabTest::testNodeTranslationUsingActions()
Tests that a node can be translated using the actions on the management page.
File
- tests/
src/ Functional/ LingotekNodeManageTranslationTabTest.php, line 303
Class
- LingotekNodeManageTranslationTabTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testNodeTranslationUsingActions() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Add a language.
ConfigurableLanguage::createFromLangcode('de')
->setThirdPartySetting('lingotek', 'locale', 'de_AT')
->save();
// 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['field_tags[target_id]'] = implode(',', [
'Camelid',
'Herbivorous',
]);
$edit['lingotek_translation_management[lingotek_translation_profile]'] = 'manual';
$this
->saveAndPublishNodeForm($edit);
$this
->createRelatedTermsForTestingDepth();
// Login as translation manager.
$this
->drupalLogin($this->translationManagerUser);
// Check that the manage tranlsations tab is in the node.
$this
->drupalGet('node/1');
$this
->clickLink('Manage Translations');
$this
->assertText('Llamas are cool');
$this
->assertText('Camelid');
$this
->assertText('Herbivorous');
// Assert second level is not included.
$this
->assertNoText('Hominid');
// Assert third level is not included.
$this
->assertNoText('Ruminant');
// I can init the upload of content.
$this
->assertLingotekUploadLink();
$edit = [
'table[node:1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForUpload('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// I can check current status.
$this
->assertLingotekCheckSourceStatusLink();
$edit = [
'table[node:1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCheckUpload('node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
// Request the German (AT) translation.
$this
->assertLingotekRequestTranslationLink('de_AT');
$edit = [
'table[node:1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForRequestTranslation('de', 'node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('de_AT', \Drupal::state()
->get('lingotek.added_target_locale'));
// Check status of the German (AT) translation.
$this
->assertLingotekCheckTargetStatusLink('de_AT');
$edit = [
'table[node:1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCheckTranslation('de', 'node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('de_AT', \Drupal::state()
->get('lingotek.checked_target_locale'));
// Download the German (AT) translation.
$this
->assertLingotekDownloadTargetLink('de_AT');
$edit = [
'table[node:1]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForDownloadTranslation('de', 'node'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->assertIdentical('de_AT', \Drupal::state()
->get('lingotek.downloaded_locale'));
// Now the link is to the workbench, and it opens in a new tab.
$this
->assertLingotekWorkbenchLink('de_AT', 'dummy-document-hash-id', 'DE');
}