Logs verbose message in a text file.

If verbose mode is enabled then page requests will be dumped to a file and presented on the test result screen. The messages will be placed in a file located in the simpletest directory in the original file system.

Parameters

$message: The verbose message to be stored.

$original_file_directory: The original file directory, before it was changed for testing purposes.

$test_class: The active test case class.

Return value

The ID of the message to be placed in related assertion messages.

See also

DrupalTestCase->originalFileDirectory

DrupalWebTestCase->verbose()

2 calls to simpletest_verbose()
DrupalTestCase::run in modules/simpletest/drupal_web_test_case.php
Run all tests in this class.
DrupalTestCase::verbose in modules/simpletest/drupal_web_test_case.php
Logs a verbose message in a text file.
2 string references to 'simpletest_verbose'
simpletest_settings_form in modules/simpletest/simpletest.pages.inc
Provides settings form for SimpleTest variables.
simpletest_uninstall in modules/simpletest/simpletest.install
Implements hook_uninstall().

File

modules/simpletest/drupal_web_test_case.php, line 4071

Code

function simpletest_verbose($message, $original_file_directory = NULL, $test_class = NULL) {
  static $file_directory = NULL, $class = NULL, $id = 1, $verbose = NULL;

  // Will pass first time during setup phase, and when verbose is TRUE.
  if (!isset($original_file_directory) && !$verbose) {
    return FALSE;
  }
  if ($message && $file_directory) {
    $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', TRUE);
    $directory = $file_directory . '/simpletest/verbose';
    $writable = file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
    if ($writable && !file_exists($directory . '/.htaccess')) {
      file_put_contents($directory . '/.htaccess', "<IfModule mod_expires.c>\nExpiresActive Off\n</IfModule>\n");
    }
    return $writable;
  }
  return FALSE;
}