Issue #2724773 by Stevel: Translation tests fail on site with english language prefix (global $language_url is not reset in tests)
parent
223cd3435b
commit
856aa8c85a
|
@ -1374,10 +1374,11 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
* @see DrupalWebTestCase::tearDown()
|
* @see DrupalWebTestCase::tearDown()
|
||||||
*/
|
*/
|
||||||
protected function prepareEnvironment() {
|
protected function prepareEnvironment() {
|
||||||
global $user, $language, $conf;
|
global $user, $language, $language_url, $conf;
|
||||||
|
|
||||||
// Store necessary current values before switching to prefixed database.
|
// Store necessary current values before switching to prefixed database.
|
||||||
$this->originalLanguage = $language;
|
$this->originalLanguage = $language;
|
||||||
|
$this->originalLanguageUrl = $language_url;
|
||||||
$this->originalLanguageDefault = variable_get('language_default');
|
$this->originalLanguageDefault = variable_get('language_default');
|
||||||
$this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files');
|
$this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files');
|
||||||
$this->originalProfile = drupal_get_profile();
|
$this->originalProfile = drupal_get_profile();
|
||||||
|
@ -1387,7 +1388,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
// Set to English to prevent exceptions from utf8_truncate() from t()
|
// Set to English to prevent exceptions from utf8_truncate() from t()
|
||||||
// during install if the current language is not 'en'.
|
// during install if the current language is not 'en'.
|
||||||
// The following array/object conversion is copied from language_default().
|
// The following array/object conversion is copied from language_default().
|
||||||
$language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
|
$language_url = $language = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '');
|
||||||
|
|
||||||
// Save and clean the shutdown callbacks array because it is static cached
|
// Save and clean the shutdown callbacks array because it is static cached
|
||||||
// and will be changed by the test run. Otherwise it will contain callbacks
|
// and will be changed by the test run. Otherwise it will contain callbacks
|
||||||
|
@ -1445,7 +1446,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
* @see DrupalWebTestCase::prepareEnvironment()
|
* @see DrupalWebTestCase::prepareEnvironment()
|
||||||
*/
|
*/
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
global $user, $language, $conf;
|
global $user, $language, $language_url, $conf;
|
||||||
|
|
||||||
// Create the database prefix for this test.
|
// Create the database prefix for this test.
|
||||||
$this->prepareDatabasePrefix();
|
$this->prepareDatabasePrefix();
|
||||||
|
@ -1542,7 +1543,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
|
|
||||||
// Set up English language.
|
// Set up English language.
|
||||||
unset($conf['language_default']);
|
unset($conf['language_default']);
|
||||||
$language = language_default();
|
$language_url = $language = language_default();
|
||||||
|
|
||||||
// Use the test mail class instead of the default mail handler class.
|
// Use the test mail class instead of the default mail handler class.
|
||||||
variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
|
variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
|
||||||
|
@ -1636,7 +1637,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
* and reset the database prefix.
|
* and reset the database prefix.
|
||||||
*/
|
*/
|
||||||
protected function tearDown() {
|
protected function tearDown() {
|
||||||
global $user, $language;
|
global $user, $language, $language_url;
|
||||||
|
|
||||||
// In case a fatal error occurred that was not in the test process read the
|
// In case a fatal error occurred that was not in the test process read the
|
||||||
// log to pick up any fatal errors.
|
// log to pick up any fatal errors.
|
||||||
|
@ -1701,6 +1702,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||||
|
|
||||||
// Reset language.
|
// Reset language.
|
||||||
$language = $this->originalLanguage;
|
$language = $this->originalLanguage;
|
||||||
|
$language_url = $this->originalLanguageUrl;
|
||||||
if ($this->originalLanguageDefault) {
|
if ($this->originalLanguageDefault) {
|
||||||
$GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
|
$GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue