public function LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.3.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.4.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.5.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.6.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.7.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
- 3.8.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testDownloadTranslationWithAnError()
Tests that we manage errors when using the download translation link.
File
- tests/
src/ Functional/ LingotekInterfaceTranslationTest.php, line 594
Class
- LingotekInterfaceTranslationTest
- Tests translating the user interface using the Lingotek form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDownloadTranslationWithAnError() {
\Drupal::state()
->set('lingotek.must_error_in_download', 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 = 1;
$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');
// Request the Spanish translation.
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component, 'es_MX');
$this
->clickLink('ES');
$this
->assertTargetStatus('ES', Lingotek::STATUS_PENDING);
// Check the status of the translation.
$this
->clickLink('ES');
$this
->assertTargetStatus('ES', Lingotek::STATUS_READY);
// Download translation.
$this
->clickLink('ES');
// We failed at downloading a translation. Mark as error.
$this
->assertTargetStatus('ES', Lingotek::STATUS_ERROR);
$assert_session
->responseContains('The \'es_MX\' translation download for <em class="placeholder">' . $component . '</em> failed. Please try again.');
}