Commit 551134fd authored by Dries's avatar Dries

- Patch #1280530 by loganfsmyth: decouple domain/path negotiation setup from...

- Patch #1280530 by loganfsmyth: decouple domain/path negotiation setup from language configuration.
parent 43473907
This diff is collapsed.
...@@ -62,13 +62,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase { ...@@ -62,13 +62,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
$edit = array( $edit = array(
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -90,10 +87,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase { ...@@ -90,10 +87,10 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.')); $this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.')); $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Check if a valid language prefix is added after changing the default // Check if a valid language prefix is added afrer changing the default
// language. // language.
$this->drupalGet('admin/config/regional/language/edit/en'); $this->drupalGet('admin/config/regional/language/configure/url');
$this->assertFieldByXPath('//input[@name="prefix"]', 'en', t('A valid path prefix has been added to the previous default language.')); $this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', t('A valid path prefix has been added to the previous default language.'));
// Ensure we can't delete the default language. // Ensure we can't delete the default language.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode); $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
...@@ -211,8 +208,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -211,8 +208,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
// This is the language indicator on the translation search screen for // This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc. // untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> "; $language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
...@@ -225,7 +220,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -225,7 +220,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -333,15 +327,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -333,15 +327,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
// Add custom language. // Add custom language.
$edit = array( $edit = array(
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -395,8 +386,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -395,8 +386,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
// This is the language indicator on the translation search screen for // This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc. // untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> "; $language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
...@@ -415,7 +404,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -415,7 +404,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -461,8 +449,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -461,8 +449,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
// This is the language indicator on the translation search screen for // This is the language indicator on the translation search screen for
// untranslated strings. Copied straight from locale.inc. // untranslated strings. Copied straight from locale.inc.
$language_indicator = "<em class=\"locale-untranslated\">$langcode</em> "; $language_indicator = "<em class=\"locale-untranslated\">$langcode</em> ";
...@@ -475,7 +461,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { ...@@ -475,7 +461,6 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -710,15 +695,12 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { ...@@ -710,15 +695,12 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
// Create a custom language. // Create a custom language.
$edit = array( $edit = array(
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -1331,13 +1313,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase { ...@@ -1331,13 +1313,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = 'xx';
$edit = array( $edit = array(
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -1349,13 +1328,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase { ...@@ -1349,13 +1328,10 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$name_disabled = $this->randomName(16); $name_disabled = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native_disabled = $this->randomName(16); $native_disabled = $this->randomName(16);
// The domain prefix.
$prefix_disabled = $langcode_disabled;
$edit = array( $edit = array(
'langcode' => $langcode_disabled, 'langcode' => $langcode_disabled,
'name' => $name_disabled, 'name' => $name_disabled,
'native' => $native_disabled, 'native' => $native_disabled,
'prefix' => $prefix_disabled,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -1532,11 +1508,14 @@ class LocalePathFunctionalTest extends DrupalWebTestCase { ...@@ -1532,11 +1508,14 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
// Set path prefix.
$edit = array( "prefix[$langcode]" => $prefix );
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
// Check that the "xx" front page is not available when path prefixes are // Check that the "xx" front page is not available when path prefixes are
// not enabled yet. // not enabled yet.
$this->drupalPost('admin/config/regional/language/configure', array(), t('Save settings')); $this->drupalPost('admin/config/regional/language/configure', array(), t('Save settings'));
...@@ -1629,6 +1608,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase { ...@@ -1629,6 +1608,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Confirm that the custom path with prefix leads to the second node. // Confirm that the custom path with prefix leads to the second node.
$this->drupalGet($prefix . '/' . $custom_path); $this->drupalGet($prefix . '/' . $custom_path);
$this->assertText($second_node->title, t('Custom alias with prefix returns second node.')); $this->assertText($second_node->title, t('Custom alias with prefix returns second node.'));
} }
} }
...@@ -1668,13 +1648,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { ...@@ -1668,13 +1648,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$name = $this->randomName(16); $name = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native = $this->randomName(16); $native = $this->randomName(16);
// The domain prefix.
$prefix = $langcode;
$edit = array( $edit = array(
'langcode' => $langcode, 'langcode' => $langcode,
'name' => $name, 'name' => $name,
'native' => $native, 'native' => $native,
'prefix' => $prefix,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -1686,13 +1663,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { ...@@ -1686,13 +1663,10 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$name_disabled = $this->randomName(16); $name_disabled = $this->randomName(16);
// The native name for the language. // The native name for the language.
$native_disabled = $this->randomName(16); $native_disabled = $this->randomName(16);
// The domain prefix.
$prefix_disabled = $langcode_disabled;
$edit = array( $edit = array(
'langcode' => $langcode_disabled, 'langcode' => $langcode_disabled,
'name' => $name_disabled, 'name' => $name_disabled,
'native' => $native_disabled, 'native' => $native_disabled,
'prefix' => $prefix_disabled,
'direction' => '0', 'direction' => '0',
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
...@@ -1912,8 +1886,8 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase { ...@@ -1912,8 +1886,8 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// Setup for domain negotiation, first configure the language to have domain // Setup for domain negotiation, first configure the language to have domain
// URL. We use https and a port to make sure that only the domain name is used. // URL. We use https and a port to make sure that only the domain name is used.
$edit = array('prefix' => '', 'domain' => "https://$language_domain:99"); $edit = array("domain[$langcode]" => "https://$language_domain:99");
$this->drupalPost("admin/config/regional/language/edit/$langcode", $edit, t('Save language')); $this->drupalPost("admin/config/regional/language/configure/url", $edit, t('Save configuration'));
// Set the site to use domain language negotiation. // Set the site to use domain language negotiation.
$tests = array( $tests = array(
...@@ -1973,8 +1947,9 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase { ...@@ -1973,8 +1947,9 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// Enable the path prefix for the default language: this way any unprefixed // Enable the path prefix for the default language: this way any unprefixed
// URL must have a valid fallback value. // URL must have a valid fallback value.
$edit = array('prefix' => 'en'); $edit = array('prefix[en]' => 'en');
$this->drupalPost('admin/config/regional/language/edit/en', $edit, t('Save language')); $this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
// Enable browser and URL language detection. // Enable browser and URL language detection.
$edit = array( $edit = array(
......
...@@ -2250,10 +2250,13 @@ class FormatDateUnitTest extends DrupalWebTestCase { ...@@ -2250,10 +2250,13 @@ class FormatDateUnitTest extends DrupalWebTestCase {
'name' => self::LANGCODE, 'name' => self::LANGCODE,
'native' => self::LANGCODE, 'native' => self::LANGCODE,
'direction' => LANGUAGE_LTR, 'direction' => LANGUAGE_LTR,
'prefix' => self::LANGCODE,
); );
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language')); $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
// Set language prefix.
$edit = array('prefix[' . self::LANGCODE . ']' => self::LANGCODE);
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
// Create a test user to carry out the tests. // Create a test user to carry out the tests.
$test_user = $this->drupalCreateUser(); $test_user = $this->drupalCreateUser();
$this->drupalLogin($test_user); $this->drupalLogin($test_user);
......
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