From 7e04923b9ea63a09531350492376b3bad53aae09 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 15 Aug 2009 17:52:53 +0000 Subject: #529126 by boombatower: Split up SimpleTest verbose output into separate files. --- modules/simpletest/drupal_web_test_case.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'modules/simpletest/drupal_web_test_case.php') 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 (:) 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 = '
ID #' . $id . '
' . $message; - file_put_contents($file_directory . '/simpletest/verbose.html', $message, FILE_APPEND); + $message = '
ID #' . $id . ' (Previous | Next)
' . $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; } -- cgit v1.2.3