public function ChineseBulkTranslationTest::testNodeTranslationUsingLinks in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 4.0.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.0.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.1.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.2.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.3.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.4.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.6.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.7.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
- 3.8.x tests/src/Functional/ChineseBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\ChineseBulkTranslationTest::testNodeTranslationUsingLinks()
Tests that a node can be translated using the links on the management page.
File
- tests/
src/ Functional/ ChineseBulkTranslationTest.php, line 63
Class
- ChineseBulkTranslationTest
- Tests translating into chinese locales.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testNodeTranslationUsingLinks() {
$assert_session = $this
->assertSession();
// 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('zh_CN');
$this
->clickLink('EN');
// There is a link for checking status.
$this
->assertLingotekCheckSourceStatusLink();
// And we can already request a translation.
$this
->assertLingotekRequestTranslationLink('zh_CN');
$this
->clickLink('EN');
$this
->assertText('The import for node Llamas are cool is complete.');
// Request the German (AT) translation.
$this
->assertLingotekRequestTranslationLink('zh_CN');
$this
->clickLink('ZH');
$this
->assertText("Locale 'zh_CN' was added as a translation target for node Llamas are cool.");
// Check that the requested locale is the right one.
$this
->assertIdentical('zh_CN', \Drupal::state()
->get('lingotek.added_target_locale'));
// Check status of the Spanish translation.
$this
->assertLingotekCheckTargetStatusLink('zh_CN');
$this
->clickLink('ZH');
$this
->assertText('The zh_CN translation for node Llamas are cool is ready for download.');
// Download the Spanish translation.
$this
->assertLingotekDownloadTargetLink('zh_CN');
$this
->clickLink('ZH');
$this
->assertText('The translation of node Llamas are cool into zh_CN has been downloaded.');
// Now the link is to the workbench, and it opens in a new tab.
$this
->assertLingotekWorkbenchLink('zh_CN');
}