? .cache ? .settings Index: modules/field/tests/field.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field.test,v retrieving revision 1.2 diff -u -p -r1.2 field.test --- modules/field/tests/field.test 21 Nov 2009 00:43:42 -0000 1.2 +++ modules/field/tests/field.test 21 Nov 2009 14:30:30 -0000 @@ -2495,6 +2495,7 @@ class FieldTranslationsTestCase extends $this->assertTrue(count($obj_info['translation']), t('Nodes are translatable.')); // Prepare the field translations. + field_test_entity_info_translatable('test_entity', TRUE); $eid = $evid = 1; $obj_type = 'test_entity'; $object = field_test_create_stub_entity($eid, $evid, $this->instance['bundle']); Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.173 diff -u -p -r1.173 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 21 Nov 2009 00:43:42 -0000 1.173 +++ modules/simpletest/drupal_web_test_case.php 21 Nov 2009 14:29:36 -0000 @@ -539,6 +539,9 @@ class DrupalUnitTestCase extends DrupalT $this->originalPrefix = $db_prefix; $this->originalFileDirectory = file_directory_path(); + // Reset all statics so that test is performed with a clean environment. + drupal_static_reset(); + // Generate temporary prefixed database to ensure that tests have a clean starting point. $db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}'); $conf['file_public_path'] = $this->originalFileDirectory . '/' . $db_prefix; @@ -1053,6 +1056,9 @@ class DrupalWebTestCase extends DrupalTe ini_set('log_errors', 1); ini_set('error_log', $directory . '/error.log'); + // Reset all statics so that test is performed with a clean environment. + drupal_static_reset(); + include_once DRUPAL_ROOT . '/includes/install.inc'; drupal_install_system(); Index: modules/simpletest/tests/bootstrap.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/bootstrap.test,v retrieving revision 1.25 diff -u -p -r1.25 bootstrap.test --- modules/simpletest/tests/bootstrap.test 15 Nov 2009 21:41:06 -0000 1.25 +++ modules/simpletest/tests/bootstrap.test 21 Nov 2009 14:29:36 -0000 @@ -405,16 +405,11 @@ class BootstrapResettableStaticTestCase $var = 'bar'; drupal_static_reset($name); $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of name-specific reset.')); - - // Ensure that batch processing doesn't get reset. - $batch = &batch_get(); - $batch_saved = $batch; $var = 'bar'; drupal_static_reset(); $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of global reset.')); $var = 'bar'; drupal_static_reset(); $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of global reset.')); - $batch = $batch_saved; } } Index: modules/simpletest/tests/common.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v retrieving revision 1.91 diff -u -p -r1.91 common.test --- modules/simpletest/tests/common.test 21 Nov 2009 00:43:42 -0000 1.91 +++ modules/simpletest/tests/common.test 21 Nov 2009 14:29:36 -0000 @@ -56,8 +56,11 @@ class DrupalAlterTestCase extends Drupal /** * Tests for URL generation functions. + * + * url() calls module_implements(), which may issue a db query, which requires + * inheriting from a web test case rather than a unit test case. */ -class CommonURLUnitTest extends DrupalUnitTestCase { +class CommonURLUnitTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'URL generation tests', @@ -70,23 +73,9 @@ class CommonURLUnitTest extends DrupalUn * Confirm that invalid text given as $path is filtered. */ function testLXSS() { - global $conf; $text = $this->randomName(); $path = ""; - // Regardless of whether there is a theme override of theme_link() or not, - // unless the 'theme_link' configuration variable is FALSE, l() will - // attempt to initialize the theme system in order to determine if - // the link needs to be themed. However, drupal_theme_initialize() requires - // a database query, which doesn't work in the context of unit tests, - // because simpletest sets up a table prefix, but doesn't generate the - // corresponding prefixed tables. We need to either circumvent theme system - // initialization, or make CommonURLUnitTest inherit from DrupalWebTestCase. - // Since our goal in this unit test is specifically to test the default - // implementation, we choose the former. - $theme_link_saved = isset($conf['theme_link']) ? $conf['theme_link'] : NULL; - $conf['theme_link'] = FALSE; $link = l($text, $path); - $conf['theme_link'] = $theme_link_saved; $sanitized_path = check_url(url($path)); $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, t('XSS attack @path was filtered', array('@path' => $path))); }