Commit 7e04923b authored by webchick's avatar webchick

#529126 by boombatower: Split up SimpleTest verbose output into separate files.

parent a148fb75
......@@ -391,7 +391,7 @@ protected function error($message = '', $group = 'Other', array $caller = NULL)
*/
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 @@ protected function assertMail($name, $value = '', $message = '') {
*/
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;
}
......@@ -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);
......
......@@ -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),
);
......
<?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');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment