summaryrefslogtreecommitdiffstatshomepage
path: root/modules/translation/translation.test
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-22 06:14:55 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-22 06:14:55 +0000
commit9463ec1d400f79e08dab3ff438b6a0c0576ec136 (patch)
tree0020866aea6506f219820bc7a5aeda5a7b483978 /modules/translation/translation.test
parenta61d3660236ac6bc3a39f413400bfebad24745c1 (diff)
downloaddrupal-9463ec1d400f79e08dab3ff438b6a0c0576ec136.tar.gz
drupal-9463ec1d400f79e08dab3ff438b6a0c0576ec136.zip
#284625 by bforchhammer, plach: Fixed Non-localized links in translation table
Diffstat (limited to 'modules/translation/translation.test')
-rw-r--r--modules/translation/translation.test22
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index 1e7bf61d683..7148db12b71 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -25,6 +25,13 @@ class TranslationTestCase extends DrupalWebTestCase {
$this->addLanguage('en');
$this->addLanguage('es');
+ // Enable language negotiation using path-prefix
+ $this->drupalGet('admin/config/regional/language/configure');
+ $edit = array();
+ $edit['language[enabled][locale-url]'] = 1;
+ $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
+ $this->assertRaw(t('Language negotiation configuration saved.'), t('URL language detection enabled.'));
+
// Set "Basic page" content type to use multilingual support with translation.
$this->drupalGet('admin/structure/types/manage/page');
$edit = array();
@@ -45,14 +52,23 @@ class TranslationTestCase extends DrupalWebTestCase {
$node_body = $this->randomName();
$node = $this->createPage($node_title, $node_body, 'en');
+ // Check that the "add translation" link uses a localized path
+ $languages = language_list();
+ $this->drupalGet('node/' . $node->nid . '/translate');
+ $this->assertLinkByHref($languages['es']->prefix . '/node/add/' . str_replace('_', '-', $node->type), 0, t('The "add translation" link for %language points to the localized path of the target language.', array('%language' => $languages['es']->name)));
+
// Submit translation in Spanish.
$node_translation_title = $this->randomName();
$node_translation_body = $this->randomName();
$node_translation = $this->createTranslation($node, $node_translation_title, $node_translation_body, 'es');
+ // Check that the "edit translation" and "view node" links use localized paths.
+ $this->drupalGet('node/' . $node->nid . '/translate');
+ $this->assertLinkByHref($languages['es']->prefix . '/node/' . $node_translation->nid . '/edit', 0, t('The "edit" link for the translation in %language points to the localized path of the translation language.', array('%language' => $languages['es']->name)));
+ $this->assertLinkByHref($languages['es']->prefix . '/node/' . $node_translation->nid, 0, t('The "view" link for the translation in %language points to the localized path of the translation language.', array('%language' => $languages['es']->name)));
+
// Attempt to submit a duplicate translation by visiting the node/add page
// with identical query string.
- $languages = language_list();
$this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'target' => 'es')));
$this->assertRaw(t('A translation of %title in %language already exists', array('%title' => $node_title, '%language' => $languages['es']->name)), t('Message regarding attempted duplicate translation is displayed.'));
@@ -118,6 +134,10 @@ class TranslationTestCase extends DrupalWebTestCase {
// Check that content translation links are shown even when no language
// negotiation is configured.
+ $this->drupalLogin($this->admin_user);
+ $edit = array('language[enabled][locale-url]' => FALSE);
+ $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
+ $this->drupalLogin($this->translator);
$languages = language_list();
$this->drupalGet("node/$node->nid");
$url = url("node/$node_translation->nid");