public function LingotekNodeBulkTranslationTest::testNodeTranslationUsingActionsForMultipleLocalesAfterEditing in Lingotek Translation 8
Tests that a node can be translated using the actions on the management page for multiple locales after editing it.
File
- src/
Tests/ LingotekNodeBulkTranslationTest.php, line 268
Class
- LingotekNodeBulkTranslationTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\lingotek\TestsCode
public function testNodeTranslationUsingActionsForMultipleLocalesAfterEditing() {
$this
->testNodeTranslationUsingActionsForMultipleLocales();
// Edit the node.
$edit = array();
$edit['title[0][value]'] = 'Llamas are cool EDITED';
$this
->drupalPostForm('node/1/edit', $edit, t('Save and keep published (this translation)'));
$basepath = \Drupal::request()
->getBasePath();
$this
->goToContentBulkManagementForm();
// Let's upload the edited content so it's updated and downloadable.
$this
->clickLink('EN');
// Check the source status is current.
$this
->clickLink('EN');
// Check all statuses, after being edited and the source re-uploaded
// Should be in STATUS_PENDING
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/check_target/dummy-document-hash-id/de_AT?destination=' . $basepath . '/admin/lingotek/manage/node');
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/check_target/dummy-document-hash-id/es_MX?destination=' . $basepath . '/admin/lingotek/manage/node');
$edit = [
'table[1]' => TRUE,
// Node 1.
'operation' => 'check_translations',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
// Download all translations.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/download/dummy-document-hash-id/de_AT?destination=' . $basepath . '/admin/lingotek/manage/node');
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/download/dummy-document-hash-id/es_MX?destination=' . $basepath . '/admin/lingotek/manage/node');
$edit = [
'table[1]' => TRUE,
// Node 1.
'operation' => 'download',
];
$this
->drupalPostForm(NULL, $edit, t('Execute'));
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.downloaded_locale'));
// Now the link is to the workbench, and it opens in a new tab.
$this
->assertLinkByHref($basepath . '/admin/lingotek/workbench/dummy-document-hash-id/es_MX');
$this
->assertLinkByHref($basepath . '/admin/lingotek/workbench/dummy-document-hash-id/de_AT');
}