summaryrefslogtreecommitdiff
path: root/modules/simpletest/drupal_web_test_case.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-15 17:52:53 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-08-15 17:52:53 +0000
commit7e04923b9ea63a09531350492376b3bad53aae09 (patch)
treee970160aeaafc2b3daf33aeeedeecf6e2465c729 /modules/simpletest/drupal_web_test_case.php
parenta148fb75b5941e15e7fc611f09eb35fb2efe5fed (diff)
downloadbrdo-7e04923b9ea63a09531350492376b3bad53aae09.tar.gz
brdo-7e04923b9ea63a09531350492376b3bad53aae09.tar.bz2
#529126 by boombatower: Split up SimpleTest verbose output into separate files.
Diffstat (limited to 'modules/simpletest/drupal_web_test_case.php')
-rw-r--r--modules/simpletest/drupal_web_test_case.php23
1 files changed, 11 insertions, 12 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;
}