summaryrefslogtreecommitdiff
path: root/modules/path
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-26 12:37:30 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-26 12:37:30 +0000
commit866a2baeeb2c0bf18e4d6162a926dd35f57a2f77 (patch)
tree219644b0d7b7bad8e958d54fe14d281347e65dd8 /modules/path
parent7a3f4822e882f02540409dc7f316da37fd187c69 (diff)
downloadbrdo-866a2baeeb2c0bf18e4d6162a926dd35f57a2f77.tar.gz
brdo-866a2baeeb2c0bf18e4d6162a926dd35f57a2f77.tar.bz2
- Patch #722354 by jhodgdon, catch: critical bug: fixed URL aliases marked 'all languages' from UI do not work. Added tests.
Diffstat (limited to 'modules/path')
-rw-r--r--modules/path/path.test80
1 files changed, 80 insertions, 0 deletions
diff --git a/modules/path/path.test b/modules/path/path.test
index c8d9f1015..77df4a488 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -308,3 +308,83 @@ class PathLanguageTestCase extends DrupalWebTestCase {
$this->assertTrue(strpos($url, $edit['path[alias]']), t('URL contains the path alias.'));
}
}
+
+/**
+ * Tests the user interface for creating path aliases, with languages.
+ */
+class PathLanguageUITestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Path aliases with languages',
+ 'description' => 'Confirm that the Path module user interface works with languages.',
+ 'group' => 'Path',
+ );
+ }
+
+ function setUp() {
+ parent::setUp('path', 'locale');
+
+ // Create and login user.
+ $web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'access administration pages'));
+ $this->drupalLogin($web_user);
+
+ // Enable French language.
+ $edit = array();
+ $edit['langcode'] = 'fr';
+
+ $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
+
+ // Set language negotiation to "Path prefix with fallback".
+ include_once DRUPAL_ROOT . '/includes/locale.inc';
+ variable_set('language_negotiation_' . LANGUAGE_TYPE_CONTENT, locale_language_negotiation_info());
+ variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
+
+ // Force inclusion of language.inc.
+ drupal_language_initialize();
+ }
+
+ /**
+ * Tests that a language-neutral URL alias works.
+ */
+ function testLanguageNeutralURLs() {
+ $name = $this->randomName(8);
+ $edit = array();
+ $edit['source'] = 'admin/config/search/path';
+ $edit['alias'] = $name;
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
+
+ $this->drupalGet($name);
+ $this->assertText(t('Filter aliases'), 'Language-neutral URL alias works');
+ }
+
+ /**
+ * Tests that a default language URL alias works.
+ */
+ function testDefaultLanguageURLs() {
+ $name = $this->randomName(8);
+ $edit = array();
+ $edit['source'] = 'admin/config/search/path';
+ $edit['alias'] = $name;
+ $edit['language'] = 'en';
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
+
+ $this->drupalGet($name);
+ $this->assertText(t('Filter aliases'), 'English URL alias works');
+ }
+
+ /**
+ * Tests that a non-default language URL alias works.
+ */
+ function testNonDefaultURLs() {
+ $name = $this->randomName(8);
+ $edit = array();
+ $edit['source'] = 'admin/config/search/path';
+ $edit['alias'] = $name;
+ $edit['language'] = 'fr';
+ $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
+
+ $this->drupalGet('fr/' . $name);
+ $this->assertText(t('Filter aliases'), 'Foreign URL alias works');
+ }
+
+}