diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-11-12 03:06:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-11-12 03:06:52 +0000 |
commit | a3daea1f8a0c0266df149c29d40f632deee79bc8 (patch) | |
tree | 0a28b0f420be373f921f40c55c9de9ee431a0372 | |
parent | bf4d7279e90578d0b363d26a856d309fb24ffbaf (diff) | |
download | brdo-a3daea1f8a0c0266df149c29d40f632deee79bc8.tar.gz brdo-a3daea1f8a0c0266df149c29d40f632deee79bc8.tar.bz2 |
- Patch #968476 by Dave Reid: use proper API for removing directory on uninstall.
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 1 | ||||
-rw-r--r-- | modules/simpletest/simpletest.install | 39 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 4 | ||||
-rw-r--r-- | modules/simpletest/simpletest.test | 1 |
4 files changed, 18 insertions, 27 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 534affd70..ecdff06ff 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1364,7 +1364,6 @@ class DrupalWebTestCase extends DrupalTestCase { // Remove all prefixed tables (all the tables in the schema). $schema = drupal_get_schema(NULL, TRUE); - $ret = array(); foreach ($schema as $name => $table) { db_drop_table($name); } diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install index e81233639..cf43884bc 100644 --- a/modules/simpletest/simpletest.install +++ b/modules/simpletest/simpletest.install @@ -7,28 +7,6 @@ */ /** - * Implements hook_uninstall(). - */ -function simpletest_uninstall() { - simpletest_clean_environment(); - - // Remove settings variables. - variable_del('simpletest_httpauth_method'); - variable_del('simpletest_httpauth_username'); - variable_del('simpletest_httpauth_password'); - variable_del('simpletest_clear_results'); - variable_del('simpletest_verbose'); - - // Remove generated files. - $path = 'public://simpletest'; - $files = file_scan_directory($path, '/.*/'); - foreach ($files as $file) { - file_unmanaged_delete($file->uri); - } - drupal_rmdir($path); -} - -/** * Implements hook_requirements(). * * Check that the cURL extension exists for PHP. @@ -174,3 +152,20 @@ function simpletest_schema() { ); return $schema; } + +/** + * Implements hook_uninstall(). + */ +function simpletest_uninstall() { + simpletest_clean_environment(); + + // Remove settings variables. + variable_del('simpletest_httpauth_method'); + variable_del('simpletest_httpauth_username'); + variable_del('simpletest_httpauth_password'); + variable_del('simpletest_clear_results'); + variable_del('simpletest_verbose'); + + // Remove generated files. + file_unmanaged_delete_recursive('public://simpletest'); +} diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 673405595..b897c0ec0 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -219,7 +219,6 @@ function _simpletest_batch_finished($success, $results, $operations, $elapsed) { list($last_prefix, $last_test_class) = simpletest_last_test_get($test_id); simpletest_log_read($test_id, $last_prefix, $last_test_class); - drupal_set_message(t('The test run did not successfully finish.'), 'error'); drupal_set_message(t('Use the <em>Clean environment</em> button to clean-up temporary files and tables.'), 'warning'); } @@ -318,13 +317,12 @@ function simpletest_test_get_all() { } else { // Select all clases in files ending with .test. - $classes = db_query("SELECT name FROM {registry} WHERE type = :type AND filename LIKE :name", array(':type' => 'class', ':name' => '%.test')); + $classes = db_query("SELECT name FROM {registry} WHERE type = :type AND filename LIKE :name", array(':type' => 'class', ':name' => '%.test'))->fetchCol(); // Check that each class has a getInfo() method and store the information // in an array keyed with the group specified in the test information. $groups = array(); foreach ($classes as $class) { - $class = $class->name; // Test classes need to implement getInfo() to be valid. if (class_exists($class) && method_exists($class, 'getInfo')) { $info = call_user_func(array($class, 'getInfo')); diff --git a/modules/simpletest/simpletest.test b/modules/simpletest/simpletest.test index dbed36760..469d2c168 100644 --- a/modules/simpletest/simpletest.test +++ b/modules/simpletest/simpletest.test @@ -497,4 +497,3 @@ class SimpleTestMissingDependentModuleUnitTest extends DrupalUnitTestCase { $this->fail(t('Running test with missing required module.')); } } - |