summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-11 17:16:45 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-11 17:16:45 +0000
commitde33f74b4040cc3f7880269152b277d90b081cc8 (patch)
tree63bb72c64d10cb48d549df7f0d9b817df0c0c8eb /modules
parentb647348fa93e7915d9a19dc2f1fd598422dca999 (diff)
downloadbrdo-de33f74b4040cc3f7880269152b277d90b081cc8.tar.gz
brdo-de33f74b4040cc3f7880269152b277d90b081cc8.tar.bz2
- Patch #688704 by Crell, boombatower, noahb: give DB its own autoload function.
Diffstat (limited to 'modules')
-rw-r--r--modules/simpletest/drupal_web_test_case.php2
-rw-r--r--modules/simpletest/simpletest.pages.inc4
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index ccc2f354b..2c6d9c919 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -566,6 +566,8 @@ class DrupalUnitTestCase extends DrupalTestCase {
$this->originalPrefix = $db_prefix;
$this->originalFileDirectory = file_directory_path();
+ spl_autoload_register('db_autoload');
+
// Reset all statics so that test is performed with a clean environment.
drupal_static_reset();
diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc
index c92926131..61bfa82f4 100644
--- a/modules/simpletest/simpletest.pages.inc
+++ b/modules/simpletest/simpletest.pages.inc
@@ -185,7 +185,9 @@ function simpletest_test_form_submit($form, &$form_state) {
// Get list of tests.
$tests_list = array();
foreach ($form_state['values'] as $class_name => $value) {
- if (class_exists($class_name) && $value === 1) {
+ // Since class_exists() will likely trigger an autoload lookup,
+ // we do the fast check first.
+ if ($value === 1 && class_exists($class_name)) {
$tests_list[] = $class_name;
}
}