diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-15 17:52:53 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-15 17:52:53 +0000 |
commit | 7e04923b9ea63a09531350492376b3bad53aae09 (patch) | |
tree | e970160aeaafc2b3daf33aeeedeecf6e2465c729 /modules | |
parent | a148fb75b5941e15e7fc611f09eb35fb2efe5fed (diff) | |
download | brdo-7e04923b9ea63a09531350492376b3bad53aae09.tar.gz brdo-7e04923b9ea63a09531350492376b3bad53aae09.tar.bz2 |
#529126 by boombatower: Split up SimpleTest verbose output into separate files.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 23 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 3 | ||||
-rw-r--r-- | modules/simpletest/simpletest.pages.inc | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/language.test | 25 |
4 files changed, 40 insertions, 13 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index ad27ac258..56636eceb 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -391,7 +391,7 @@ abstract class DrupalTestCase { */ public function run() { // Initialize verbose debugging. - simpletest_verbose(NULL, file_directory_path()); + simpletest_verbose(NULL, file_directory_path(), get_class($this)); // HTTP auth settings (<username>:<password>) for the simpletest browser // when sending requests to the test site. @@ -2490,7 +2490,7 @@ class DrupalWebTestCase extends DrupalTestCase { */ protected function verbose($message) { if ($id = simpletest_verbose($message)) { - $this->pass(l(t('Verbose message'), $this->originalFileDirectory . '/simpletest/verbose.html', array('fragment' => $id)), 'Debug'); + $this->pass(l(t('Verbose message'), $this->originalFileDirectory . '/simpletest/verbose/' . get_class($this) . '-' . $id . '.html', array('attributes' => array('target' => '_blank'))), 'Debug'); } } } @@ -2522,13 +2522,15 @@ function drupal_mail_wrapper($message) { * The verbose message to be stored. * @param $original_file_directory * The original file directory, before it was changed for testing purposes. + * @param $test_class + * The active test case class. * @return * The ID of the message to be placed in related assertion messages. * @see DrupalTestCase->originalFileDirectory * @see DrupalWebTestCase->verbose() */ -function simpletest_verbose($message, $original_file_directory = NULL) { - static $file_directory = NULL, $id = 0; +function simpletest_verbose($message, $original_file_directory = NULL, $test_class = NULL) { + static $file_directory = NULL, $class = NULL, $id = 1; $verbose = &drupal_static(__FUNCTION__); // Will pass first time during setup phase, and when verbose is TRUE. @@ -2537,21 +2539,18 @@ function simpletest_verbose($message, $original_file_directory = NULL) { } if ($message && $file_directory) { - $message = '<hr /><a id="' . $id . '" href="#' . $id . '">ID #' . $id . '</a><hr />' . $message; - file_put_contents($file_directory . '/simpletest/verbose.html', $message, FILE_APPEND); + $message = '<hr />ID #' . $id . ' (<a href="' . $class . '-' . ($id - 1) . '.html">Previous</a> | <a href="' . $class . '-' . ($id + 1) . '.html">Next</a>)<hr />' . $message; + file_put_contents($file_directory . "/simpletest/verbose/$class-$id.html", $message, FILE_APPEND); return $id++; } if ($original_file_directory) { $file_directory = $original_file_directory; + $class = $test_class; $verbose = variable_get('simpletest_verbose', FALSE); - // Clear out the previous log. - $message = t('Starting verbose log at @time.', array('@time' => format_date(time()))) . "\n"; - $directory = $file_directory . '/simpletest'; - if (file_check_directory($directory, FILE_CREATE_DIRECTORY)) { - file_put_contents($directory . '/verbose.html', $message); - } + $directory = $file_directory . '/simpletest/verbose'; + return file_check_directory($directory, FILE_CREATE_DIRECTORY); } return FALSE; } diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 18f0b0390..53a6db809 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -121,6 +121,9 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') { $test_id = db_insert('simpletest_test_id') ->useDefaults(array('test_id')) ->execute(); + + // Clear out the previous verbose files. + file_unmanaged_delete_recursive(file_directory_path() . '/simpletest/verbose'); // Get the info for the first test being run. $first_test = array_shift($test_list); diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc index 3b0952f16..04ab6fe22 100644 --- a/modules/simpletest/simpletest.pages.inc +++ b/modules/simpletest/simpletest.pages.inc @@ -433,7 +433,7 @@ function simpletest_settings_form(&$form_state) { $form['general']['simpletest_verbose'] = array( '#type' => 'checkbox', '#title' => t('Provide verbose information when running tests'), - '#description' => t('The verbose data will be printed along with the standard assertions. Useful for debugging.'), + '#description' => t('The verbose data will be printed along with the standard assertions and is useful for debugging. The verbose data will be erased between each test suite run. The verbose data output is very detailed and should only be used when debugging.'), '#default_value' => variable_get('simpletest_verbose', FALSE), ); diff --git a/modules/simpletest/tests/language.test b/modules/simpletest/tests/language.test new file mode 100644 index 000000000..b1245ed3d --- /dev/null +++ b/modules/simpletest/tests/language.test @@ -0,0 +1,25 @@ +<?php +// $Id$ + +/** + * @file + * Tests for language handling functionality. + */ + +/** + * Language test case. + */ +class LanguageTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'Language', + 'description' => 'Checks language handling functionality.', + 'group' => 'Locale', + ); + } + + function setUp() { + parent::setUp('locale'); + } +} |