public function LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.2.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.3.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.4.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.5.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.6.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
- 3.8.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testRequestTranslationWithADocumentArchivedError()
Tests that we manage errors when using the request translation link.
File
- tests/
src/ Functional/ LingotekInterfaceTranslationTest.php, line 482
Class
- LingotekInterfaceTranslationTest
- Tests translating the user interface using the Lingotek form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testRequestTranslationWithADocumentArchivedError() {
\Drupal::state()
->set('lingotek.must_document_archived_error_in_request_translation', TRUE);
// In Drupal.org CI the module will be at modules/contrib/lingotek.
// In my local that's modules/lingotek. We need to generate the path and not
// hardcode it.
$path = drupal_get_path('module', 'lingotek_interface_translation_test');
$component = $path;
$indexOfModuleLink = 2;
$assert_session = $this
->assertSession();
// Login as admin.
$this
->drupalLogin($this->rootUser);
$this
->goToInterfaceTranslationManagementForm();
$assert_session
->responseContains('lingotek_interface_translation_test');
// Clicking English must init the upload of content.
$this
->assertLingotekInterfaceTranslationUploadLink($component);
$this
->clickLink('EN', $indexOfModuleLink);
$assert_session
->responseContains('<em class="placeholder">' . $component . '</em> uploaded successfully');
// I can check current status.
$this
->assertLingotekInterfaceTranslationCheckSourceStatusLink($component);
$this
->clickLink('EN', $indexOfModuleLink);
$assert_session
->responseContains('The import for <em class="placeholder">' . $component . '</em> is complete.');
// Request the Spanish translation.
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component, 'es_MX');
$this
->clickLink('ES');
// We cannot use ::assertSourceStatus, there are lots of untracked docs, but
// checking the upload link should suffice.
// $this->assertSourceStatus('EN', Lingotek::STATUS_UNTRACKED);
// This assertions were true when we marked them as archived. Now we autorequest them again.
// $this->assertLingotekInterfaceTranslationUploadLink($component);
// $this->assertNoLingotekInterfaceTranslationRequestTranslationLink($component, 'es_MX');
$this
->assertNoLingotekInterfaceTranslationUploadLink($component);
$this
->assertLingotekInterfaceTranslationCheckSourceStatusLink($component);
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component, 'es_MX');
$assert_session
->responseContains('Document <em class="placeholder">' . $component . '</em> has been archived. Uploading again.');
$assert_session
->responseContains('<em class="placeholder">' . $component . '</em> uploaded successfully');
}