summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-04-30 21:31:44 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-04-30 21:31:44 -0700
commitb7ac66710151bfbb197e653c1d03a43d2ccfcbfa (patch)
treec85164d8dc84c1e78a65f4841f7b928767a0c4c0 /modules/simpletest
parentd0b5d31cbca7b5ce521ee180b6ca31e301b63b4e (diff)
downloadbrdo-b7ac66710151bfbb197e653c1d03a43d2ccfcbfa.tar.gz
brdo-b7ac66710151bfbb197e653c1d03a43d2ccfcbfa.tar.bz2
Issue #1213536 by David_Rothstein, tim.plunkett, sun, effulgentsia, Yorirou, xjm: Fixed Non-resettable theme_get_registry() cache causes problems for non-interactive installations.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php8
-rw-r--r--modules/simpletest/tests/theme.test13
-rw-r--r--modules/simpletest/tests/theme_test.module10
3 files changed, 27 insertions, 4 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 42bab12ce..251c5c1bc 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1271,6 +1271,10 @@ class DrupalWebTestCase extends DrupalTestCase {
->condition('test_id', $this->testId)
->execute();
+ // Reset all statics and variables to perform tests in a clean environment.
+ $conf = array();
+ drupal_static_reset();
+
// Clone the current connection and replace the current prefix.
$connection_info = Database::getConnectionInfo('default');
Database::renameConnection('default', 'simpletest_original_default');
@@ -1318,10 +1322,6 @@ class DrupalWebTestCase extends DrupalTestCase {
ini_set('log_errors', 1);
ini_set('error_log', $public_files_directory . '/error.log');
- // Reset all statics and variables to perform tests in a clean environment.
- $conf = array();
- drupal_static_reset();
-
// Set the test information for use in other parts of Drupal.
$test_info = &$GLOBALS['drupal_test_info'];
$test_info['test_run_id'] = $this->databasePrefix;
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index 85f67b460..ba6440028 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -111,6 +111,19 @@ class ThemeTestCase extends DrupalWebTestCase {
$this->drupalGet('theme-test/suggestion');
variable_set('preprocess_css', 0);
}
+
+ /**
+ * Ensures the theme registry is rebuilt when modules are disabled/enabled.
+ */
+ function testRegistryRebuild() {
+ $this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.');
+
+ module_disable(array('theme_test'), FALSE);
+ $this->assertIdentical(theme('theme_test_foo', array('foo' => 'b')), '', 'The theme registry does not contain theme_test_foo, because the module is disabled.');
+
+ module_enable(array('theme_test'), FALSE);
+ $this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.');
+ }
}
/**
diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module
index cce7b8093..a9bd2ad24 100644
--- a/modules/simpletest/tests/theme_test.module
+++ b/modules/simpletest/tests/theme_test.module
@@ -14,6 +14,9 @@ function theme_test_theme($existing, $type, $theme, $path) {
$items['theme_test_template_test_2'] = array(
'template' => 'theme_test.template_test',
);
+ $items['theme_test_foo'] = array(
+ 'variables' => array('foo' => NULL),
+ );
return $items;
}
@@ -120,3 +123,10 @@ function _theme_test_alter() {
function _theme_test_suggestion() {
return theme(array('theme_test__suggestion', 'theme_test'), array());
}
+
+/**
+ * Theme function for testing theme('theme_test_foo').
+ */
+function theme_theme_test_foo($variables) {
+ return $variables['foo'];
+}