public function LingotekNodeBulkLocaleTranslationTest::testSourceUpdatedAfterRequestingTranslation in Lingotek Translation 8
Tests that source is updated after requesting translation.
File
- src/
Tests/ LingotekNodeBulkLocaleTranslationTest.php, line 153
Class
- LingotekNodeBulkLocaleTranslationTest
- Tests translating a node into locales using the bulk management form.
Namespace
Drupal\lingotek\TestsCode
public function testSourceUpdatedAfterRequestingTranslation() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Create a node.
$edit = array();
$edit['title[0][value]'] = 'Llamas are cool';
$edit['body[0][value]'] = 'Llamas are very cool';
$edit['langcode[0][value]'] = 'en';
$edit['lingotek_translation_profile'] = 'automatic';
$this
->drupalPostForm('node/add/article', $edit, t('Save and publish'));
$this
->goToContentBulkManagementForm();
$basepath = \Drupal::request()
->getBasePath();
// There is a link for checking status.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/check_upload/dummy-document-hash-id?destination=' . $basepath . '/admin/lingotek/manage/node');
// And we can already request a translation.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/add_target/dummy-document-hash-id/de_AT?destination=' . $basepath . '/admin/lingotek/manage/node');
// Request the German (AT) translation.
$this
->assertLinkByHref($basepath . '/admin/lingotek/entity/add_target/dummy-document-hash-id/de_AT?destination=' . $basepath . '/admin/lingotek/manage/node');
$this
->clickLink('DE-AT');
$this
->assertText("Locale 'de_AT' was added as a translation target for node Llamas are cool.");
// Check that the source status has been updated.
$this
->assertNoLinkByHref($basepath . '/admin/lingotek/entity/check_upload/dummy-document-hash-id?destination=' . $basepath . '/admin/lingotek/manage/node');
}