public function LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata in Lingotek Translation 3.5.x
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.2.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.3.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.4.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.6.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.7.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
- 3.8.x tests/src/Functional/LingotekInterfaceTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekInterfaceTranslationTest::testClearInterfaceTranslationMetadata()
Tests that a node can be translated using the links on the management page.
File
- tests/
src/ Functional/ LingotekInterfaceTranslationTest.php, line 205
Class
- LingotekInterfaceTranslationTest
- Tests translating the user interface using the Lingotek form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testClearInterfaceTranslationMetadata() {
// 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.
$path1 = drupal_get_path('module', 'lingotek_interface_translation_test');
$path2 = drupal_get_path('module', 'lingotek_test');
$component1 = $path1;
$component2 = $path2;
$indexOfModuleLink1 = 2;
$indexOfModuleLink2 = 3;
$assert_session = $this
->assertSession();
// Login as admin.
$this
->drupalLogin($this->rootUser);
$this
->goToInterfaceTranslationManagementForm();
$assert_session
->responseContains('lingotek_test');
$assert_session
->responseContains('lingotek_interface_translation_test');
// Clicking English must init the upload of content.
$this
->assertLingotekInterfaceTranslationUploadLink($component1);
$this
->assertLingotekInterfaceTranslationUploadLink($component2);
// And we cannot request yet a translation.
$this
->assertNoLingotekInterfaceTranslationRequestTranslationLink($component1, 'es_MX');
$this
->assertNoLingotekInterfaceTranslationRequestTranslationLink($component2, 'es_MX');
$this
->clickLink('EN', $indexOfModuleLink1);
$assert_session
->responseContains('<em class="placeholder">' . $component1 . '</em> uploaded successfully');
$this
->clickLink('EN', $indexOfModuleLink2);
$assert_session
->responseContains('<em class="placeholder">' . $component2 . '</em> uploaded successfully');
// There is a link for checking status.
$this
->assertLingotekInterfaceTranslationCheckSourceStatusLink($component1);
$this
->assertLingotekInterfaceTranslationCheckSourceStatusLink($component2);
// And we can already request a translation.
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component1, 'es_MX');
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component2, 'es_MX');
$this
->clickLink('EN', $indexOfModuleLink1);
$assert_session
->responseContains('The import for <em class="placeholder">' . $component1 . '</em> is complete.');
// Request the Spanish translation.
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component1, 'es_MX');
$this
->assertLingotekInterfaceTranslationRequestTranslationLink($component2, 'es_MX');
$this
->clickLink('ES');
$assert_session
->responseContains('Locale \'es_MX\' was added as a translation target for <em class="placeholder">' . $component1 . '</em>.');
$this
->drupalPostForm(NULL, [], 'Clear Lingotek interface translation metadata');
$assert_session
->responseContains('This will remove the metadata stored about your Lingotek interface translations, so you will need to re-upload those in case you want to translate them.');
$this
->drupalPostForm(NULL, [], 'Clear metadata');
$assert_session
->responseContains('You have cleared the Lingotek metadata for interface translations.');
// Download the Spanish translation.
// Clicking English must init the upload of content.
$this
->assertLingotekInterfaceTranslationUploadLink($component1);
$this
->assertLingotekInterfaceTranslationUploadLink($component2);
// And we cannot request yet a translation.
$this
->assertNoLingotekInterfaceTranslationRequestTranslationLink($component1, 'es_MX');
$this
->assertNoLingotekInterfaceTranslationRequestTranslationLink($component2, 'es_MX');
}