Commit 866a2bae authored by Dries's avatar Dries

- Patch #722354 by jhodgdon, catch: critical bug: fixed URL aliases marked...

- Patch #722354 by jhodgdon, catch: critical bug: fixed URL aliases marked 'all languages' from UI do not work. Added tests.
parent 7a3f4822
......@@ -340,7 +340,7 @@ function locale_form_path_admin_form_alter(&$form, &$form_state) {
$form['language'] = array(
'#type' => 'select',
'#title' => t('Language'),
'#options' => array('' => t('All languages')) + locale_language_list('name'),
'#options' => array(LANGUAGE_NONE => t('All languages')) + locale_language_list('name'),
'#default_value' => $form['language']['#value'],
'#weight' => -10,
'#description' => t('A path alias set for a specific language will always be used when displaying this page in that language, and takes precedence over path aliases set for <em>All languages</em>.'),
......
......@@ -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');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment