public function LingotekNodeBulkTranslationTest::testAddingContentInDifferentLocale in Lingotek Translation 8
Test that when a node is uploaded in a different locale that locale is used.
File
- src/
Tests/ LingotekNodeBulkTranslationTest.php, line 606
Class
- LingotekNodeBulkTranslationTest
- Tests translating a node using the bulk management form.
Namespace
Drupal\lingotek\TestsCode
public function testAddingContentInDifferentLocale() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Create a node.
$edit = array();
$edit['title[0][value]'] = 'Llamas are cool es-MX';
$edit['body[0][value]'] = 'Llamas are very cool es-MX';
$edit['langcode[0][value]'] = 'es';
$edit['lingotek_translation_profile'] = 'manual';
$this
->drupalPostForm('node/add/article', $edit, t('Save and publish'));
$this
->goToContentBulkManagementForm();
$basepath = \Drupal::request()
->getBasePath();
// Clicking Spanish must init the upload of content.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/upload/node/1?destination=' . $basepath . '/admin/lingotek/manage/node');
// And we cannot request yet a translation.
$this
->assertNoLinkByHref($basepath . '/admin/lingotek/entity/add_target/dummy-document-hash-id/en_US?destination=' . $basepath . '/admin/lingotek/manage/node');
$this
->clickLink('ES');
$this
->assertText('Node Llamas are cool es-MX has been uploaded.');
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.uploaded_locale'));
}