From 866a2baeeb2c0bf18e4d6162a926dd35f57a2f77 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 26 Mar 2010 12:37:30 +0000 Subject: - Patch #722354 by jhodgdon, catch: critical bug: fixed URL aliases marked 'all languages' from UI do not work. Added tests. --- modules/path/path.test | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'modules/path') 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'); + } + +} -- cgit v1.2.3