public function LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 4.0.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.0.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.1.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.2.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.3.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.4.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.5.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.6.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- 3.8.x tests/src/Functional/LingotekContentTypeBulkTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
Tests that a config can be translated using the links on the management page.
3 calls to LingotekContentTypeBulkTranslationTest::testContentTypeTranslationUsingLinks()
- LingotekContentTypeBulkTranslationTest::testAddingLanguageAllowsRequesting in tests/
src/ Functional/ LingotekContentTypeBulkTranslationTest.php - Tests that a config can be translated using the links on the management page.
- LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinks in tests/
src/ Functional/ LingotekContentTypeBulkTranslationTest.php - Tests that a config can be translated using the links on the management page.
- LingotekContentTypeBulkTranslationTest::testEditedConfigTranslationUsingLinksInAutomaticUploadMode in tests/
src/ Functional/ LingotekContentTypeBulkTranslationTest.php - Tests that a node can be translated using the links on the management page.
File
- tests/
src/ Functional/ LingotekContentTypeBulkTranslationTest.php, line 48
Class
- LingotekContentTypeBulkTranslationTest
- Tests translating a config entity using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testContentTypeTranslationUsingLinks() {
$assert_session = $this
->assertSession();
// Login as admin.
$this
->drupalLogin($this->rootUser);
// Go to the bulk config management page.
$this
->goToConfigBulkManagementForm('node_type');
$basepath = \Drupal::request()
->getBasePath();
// Clicking English must init the upload of content.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
// And we cannot request yet a translation.
$assert_session
->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN');
$this
->assertText(t('Article uploaded successfully'));
$this
->assertIdentical('en_US', \Drupal::state()
->get('lingotek.uploaded_locale'));
// Ensure it has the expected timestamp for updated and upload
$timestamp = \Drupal::time()
->getRequestTime();
foreach (LingotekConfigMetadata::loadMultiple() as $metadata) {
$this
->assertEmpty($metadata
->getLastUpdated());
$this
->assertEquals($timestamp, $metadata
->getLastUploaded());
}
// There is a link for checking status.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
// And we can already request a translation.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN');
$this
->assertText('Article status checked successfully');
// Request the Spanish translation.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('ES');
$this
->assertText("Translation to es_MX requested successfully");
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.added_target_locale'));
// Check status of the Spanish translation.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/check_download/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('ES');
$this
->assertIdentical('es_MX', \Drupal::state()
->get('lingotek.checked_target_locale'));
$this
->assertText("Translation to es_MX status checked successfully");
// Download the Spanish translation.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/download/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('ES');
$this
->assertText('Translation to es_MX downloaded successfully');
$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
->assertLingotekWorkbenchLink('es_MX', 'dummy-document-hash-id', 'ES');
}