? .DS_Store
? doc_fixes.patch
? garland_page_cleanup.patch
? module_revamp_3.patch
? simpletest_message_filtering_04.patch
? simpletest_replace_simpletest.patch
? taxonomy_vocab.patch
? modules/.DS_Store
? modules/simpletest/.DS_Store
? sites/default/files
? sites/default/settings.php
Index: modules/simpletest/default_reporter.php
===================================================================
RCS file: modules/simpletest/default_reporter.php
diff -N modules/simpletest/default_reporter.php
--- modules/simpletest/default_reporter.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-<?php
-// $Id: default_reporter.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    Parser for command line arguments. Extracts
- *    the a specific test to run and engages XML
- *    reporting when necessary.
- */
-class SimpleCommandLineParser {
-  protected $to_property = array('c' => 'case', 't' => 'test');
-  protected $case = '';
-  protected $test = '';
-  protected $xml = false;
-
-  function SimpleCommandLineParser($arguments) {
-    if (!is_array($arguments)) {
-      return;
-    }
-    foreach ($arguments as $i => $argument) {
-      if (preg_match('/^--?(test|case|t|c)=(.+)$/', $argument, $matches)) {
-        $this->{$this->_parseProperty($matches[1])} = $matches[2];
-      }
-      elseif (preg_match('/^--?(test|case|t|c)$/', $argument, $matches)) {
-        if (isset($arguments[$i + 1])) {
-          $this->{$this->_parseProperty($matches[1])} = $arguments[$i + 1];
-        }
-      }
-      elseif (preg_match('/^--?(xml|x)$/', $argument)) {
-        $this->xml = true;
-      }
-    }
-  }
-  function _parseProperty($property) {
-    if (isset($this->to_property[$property])) {
-      return $this->to_property[$property];
-    }
-    else {
-      return $property;
-    }
-  }
-  function getTest() {
-    return $this->test;
-  }
-
-  function getTestCase() {
-    return $this->case;
-  }
-
-  function isXml() {
-    return $this->xml;
-  }
-}
-
-/**
- *    The default reporter used by SimpleTest's autorun
- *    feature. The actual reporters used are dependency
- *    injected and can be overridden.
- */
-class DefaultReporter extends SimpleReporterDecorator {
-  /**
-   *  Assembles the appopriate reporter for the environment.
-   */
-  function DefaultReporter() {
-    if (SimpleReporter::inCli()) {
-      global $argv;
-      $parser = new SimpleCommandLineParser($argv);
-      $interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter');
-      $reporter = &new SelectiveReporter(SimpleTest::preferred($interfaces), $parser->getTestCase(), $parser->getTest());
-    }
-    else {
-      $reporter = &new SelectiveReporter(SimpleTest::preferred('HtmlReporter'), @$_GET['c'], @$_GET['t']);
-    }
-    $this->SimpleReporterDecorator($reporter);
-  }
-}
Index: modules/simpletest/drupal_reporter.php
===================================================================
RCS file: modules/simpletest/drupal_reporter.php
diff -N modules/simpletest/drupal_reporter.php
--- modules/simpletest/drupal_reporter.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,257 +0,0 @@
-<?php
-// $Id: drupal_reporter.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- * Minimal drupal displayer. Accumulates output to $_output.
- * Based on HtmlReporter by Marcus Baker
- */
-class DrupalReporter extends SimpleReporter {
-  var $_output_error = '';
-  var $_character_set;
-  var $_fails_stack      = array(0);
-  var $_exceptions_stack = array(0);
-  var $_passes_stack     = array(0);
-  var $_progress_stack   = array(0);
-  var $test_info_stack   = array();
-  var $_output_stack_id  = -1;
-  var $form;
-  var $form_depth = array();
-  var $current_field_set = array();
-  var $content_count = 0;
-  var $weight = -10;
-  var $test_stack = array();
-
-  function DrupalReporter($character_set = 'ISO-8859-1') {
-    $this->SimpleReporter();
-    drupal_add_css(drupal_get_path('module', 'simpletest') .'/simpletest.css');
-    $this->_character_set = $character_set;
-  }
-
-  /**
-   * Paints the top of the web page setting the
-   * title to the name of the starting test.
-   * @param string $test_name      Name class of test.
-   * @access public
-   **/
-  function paintHeader($test_name) {
-
-  }
-
-  /**
-   * Paints the end of the test with a summary of
-   * the passes and failures.
-   * @param string $test_name        Name class of test.
-   * @access public
-   */
-  function paintFooter($test_name) {
-    $ok = ($this->getFailCount() + $this->getExceptionCount() == 0);
-    $class = $ok ? 'simpletest-pass' : 'simpletest-fail';
-    $this->writeContent('<strong>' . $this->getPassCount() . '</strong> passes, <strong>' . $this->getFailCount() . '</strong> fails and <strong>' . $this->getExceptionCount() . '<strong> exceptions.');
-  }
-
-  /**
-   * Paints the test passes
-   * @param string $message    Failure message displayed in
-   *                           the context of the other tests.
-   * @access public
-   **/
-  function paintPass($message, $group) {
-    parent::paintPass($message);
-    if ($group == 'Other') {
-      $group = t($group);
-    }
-    $this->test_stack[] = array(
-      'data' => array($message,  "<strong>[$group]</strong>", t('Pass'), theme('image', 'misc/watchdog-ok.png')),
-      'class' => 'simpletest-pass',
-    );
-  }
-
-  /**
-   * Paints the test failure with a breadcrumbs
-   * trail of the nesting test suites below the
-   * top level test.
-   * @param string $message    Failure message displayed in
-   *                           the context of the other tests.
-   * @access public
-   */
-  function paintFail($message, $group) {
-    parent::paintFail($message);
-    if ($group == 'Other') {
-      $group = t($group);
-    }
-    $this->test_stack[] = array(
-      'data' => array($message, "<strong>[$group]</strong>", t('Fail'), theme('image', 'misc/watchdog-error.png')),
-      'class' => 'simpletest-fail',
-    );
-  }
-
-
-  /**
-   * Paints a PHP error or exception.
-   * @param string $message        Message is ignored.
-   * @access public
-   **/
-  function paintError($message) {
-    parent::paintError($message);
-    $this->test_stack[] = array(
-      'data' => array($message, '<strong>[PHP]</strong>', t('Exception'), theme('image', 'misc/watchdog-warning.png')),
-      'class' => 'simpletest-exception',
-    );
-  }
-
-  /**
-   * Paints the start of a group test. Will also paint
-   * the page header and footer if this is the
-   * first test. Will stash the size if the first
-   * start.
-   * @param string  $test_name   Name of test that is starting.
-   * @param integer $size       Number of test cases starting.
-   * @access public
-   */
-  function paintGroupStart($test_name, $size, $extra = '') {
-    $this->_progress_stack[] = $this->_progress;
-    $this->_progress = 0;
-    $this->_exceptions_stack[] = $this->_exceptions;
-    $this->_exceptions = 0;
-    $this->_fails_stack[] = $this->_fails;
-    $this->_fails = 0;
-    $this->_passes_stack[] = $this->_passes;
-    $this->_passes = 0;
-    $this->form_depth[] = $test_name;
-    $this->writeToLastField($this->form, array(
-      '#type' => 'fieldset',
-      '#title' => $test_name,
-      '#weight' => $this->weight++,
-    ), $this->form_depth);
-
-    if (! isset($this->_size)) {
-      $this->_size = $size;
-    }
-
-    if (($c = count($this->test_info_stack)) > 0) {
-      $info = $this->test_info_stack[$c - 1];
-      $this->writeContent('<strong>' . $info['name'] . '</strong>: ' . $info['description'], $this->getParentWeight() );
-    }
-
-    $this->_test_stack[] = $test_name;
-  }
-
-  function paintCaseStart($test_name) {
-    $this->_progress++;
-    $this->paintGroupStart($test_name, 1);
-  }
-
-
-  /**
-   * Paints the end of a group test. Will paint the page
-   * footer if the stack of tests has unwound.
-   * @param string $test_name   Name of test that is ending.
-   * @param integer $progress   Number of test cases ending.
-   * @access public
-   */
-  function paintGroupEnd($test_name) {
-    array_pop($this->_test_stack);
-    $ok = ($this->getFailCount() + $this->getExceptionCount() == 0);
-    $class = $ok ? "simpletest-pass" : "simpletest-fail";
-    $parent_weight = $this->getParentWeight() - 0.5;
-    /* Exception for the top groups, no subgrouping for singles */
-    if (($this->_output_stack_id == 2) && ($this->_output_stack[$this->_output_stack_id]['size'] == 1)) {
-      $this->writeContent(format_plural($this->getTestCaseProgress(), '1 test case complete: ', '@count test cases complete: '), -10);
-      $parent_weight = $this->getParentWeight() - 0.5;
-      $this->writeContent('<strong>' . $this->getPassCount() . '</strong> passes, <strong>' . $this->getFailCount() . '</strong> fails and <strong>' . $this->getExceptionCount() . '</strong> exceptions.', $parent_weight, $class);
-      array_pop($this->form_depth);
-    }
-    else {
-      $collapsed = $ok ? TRUE : FALSE;
-      if ($this->getTestCaseProgress()) {
-        $this->writeContent(format_plural($this->getTestCaseProgress(), '1 test case complete: ', '@count test cases complete: '), -10);
-        $use_grouping = FALSE;
-      }
-      else {
-        $use_grouping = TRUE;
-      }
-      $write = array('#collapsible' => $use_grouping, '#collapsed' => $collapsed);
-      $this->writeToLastField($this->form, $write, $this->form_depth);
-    $this->writeContent('<strong>' . $this->getPassCount() . '</strong> passes, <strong>' . $this->getFailCount() . '</strong> fails and <strong>' . $this->getExceptionCount() . '</strong> exceptions.', $parent_weight, $class);
-    if (count($this->test_stack) != 0) {
-        $this->writeContent(theme('table', array(), $this->test_stack));
-        $this->test_stack = array();
-      }
-    array_pop($this->form_depth);
-    }
-
-    $this->_progress   += array_pop($this->_progress_stack);
-    $this->_exceptions += array_pop($this->_exceptions_stack);
-    $this->_fails      += array_pop($this->_fails_stack);
-    $this->_passes     += array_pop($this->_passes_stack);
-  }
-
-  function paintCaseEnd($test_name) {
-    $this->paintGroupEnd($test_name);
-  }
-
-  /**
-   * Could be extended to show more headers or whatever?
-   **/
-  function getOutput() {
-    return drupal_get_form('unit_tests', $this);
-  }
-
-  /**
-   * Recursive function that writes attr to the deepest array
-   */
-  function writeToLastField(&$form, $attr, $keys) {
-    while(count($keys) != 0) {
-      $value = array_shift($keys);
-      if (isset($form[$value])) {
-        if (count($keys) == 0) {
-          $form[$value] += $attr;
-        }
-        else {
-          $this->writeToLastField($form[$value], $attr, $keys);
-        }
-        $keys = array();
-      }
-      else {
-        $form[$value] = $attr;
-      }
-    }
-  }
-
-  /**
-   * writes $msg into the deepest fieldset
-   * @param $msg content to write
-   */
-  function writeContent($msg, $weight = NULL, $class = 'simpletest') {
-    if (!$weight) {
-      $weight = $this->weight++;
-    }
-    $write['content'.$this->content_count++] = array(
-      '#value' => '<div class=' . $class .'>' . $msg . '</div>',
-      '#weight' => $weight,
-    );
-    $this->writeToLastField($this->form, $write, $this->form_depth);
-  }
-
-  /**
-   * Retrieves weight of the currently deepest fieldset
-   */
-  function getParentWeight($form = NULL, $keys = NULL ) {
-    if (!isset($form)) {
-      $form = $this->form;
-    }
-    if (!isset($keys)) {
-      $keys = $this->form_depth;
-    }
-    if(count($keys) != 0) {
-      $value = array_shift($keys);
-      return $this->getParentWeight($form[$value], $keys);
-    }
-    return $form['#weight'];
-  }
-}
-
-function unit_tests($args, $reporter) {
-  return $reporter->form['Drupal Unit Tests'];
-}
-?>
\ No newline at end of file
Index: modules/simpletest/drupal_test_case.php
===================================================================
RCS file: modules/simpletest/drupal_test_case.php
diff -N modules/simpletest/drupal_test_case.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/drupal_test_case.php	29 Apr 2008 05:22:45 -0000
@@ -0,0 +1,92 @@
+<?php
+// $Id$
+
+class DrupalTestCase {
+  protected $test_stack;
+  protected function assert($status, $message = NULL, $group = 'Other', $custom_caller = NULL) {
+    if (is_bool($status)) {
+      if ($status) {
+        $status = SIMPLETEST_ASSERTION_PASS;
+      }
+      else {
+        $status = SIMPLETEST_ASSERTION_FAIL;
+      }
+    }
+    if (!isset($custom_caller)) {
+      $callers = debug_backtrace();
+      foreach ($callers as $caller) {
+        if (strpos($caller['function'], 'test') === 0) {
+          $function = $caller;
+          break;
+        }
+      }
+    }
+    else {
+      $function = $custom_caller;
+    }
+    $this->test_stack[] = array(
+      'status'  => $status,
+      'message' => $message,
+      'group'   => $group,
+      'caller'  => $function['function'],
+      'line'    => $function['line'],
+      'file'    => $function['file'],
+    );
+  }
+  protected function assertTrue($value, $message = '', $group = 'Other') {
+    $this->assert((bool) $value, $message, $group);
+  }
+  protected function assertFalse($value, $message = '', $group = 'Other') {
+    $this->assert(!((bool) $value), $message, $group);
+  }
+  protected function assertNull($value, $message = '', $group = 'Other') {
+    $this->assert(!isset($value), $message, $group);
+  }
+  protected function assertNotNull($value, $message = '', $group = 'Other') {
+    $this->assert(isset($value), $message, $group);
+  }
+  protected function assertEqual($first, $second, $message = '', $group = 'Other') {
+    $this->assert($first == $second, $message, $group);
+  }
+  protected function assertNotEqual($first, $second, $message = '', $group = 'Other') {
+    $this->assert($first != $second, $message, $group);
+  }
+  protected function assertIdentical($first, $second, $message = '', $group = 'Other') {
+    $this->assert($first === $second, $message, $group);
+  }
+  protected function assertNotIdentical($first, $second, $message = '', $group = 'Other') {
+    $this->assert($first !== $second, $message, $group);
+  }
+  protected function assertPattern($pattern, $subject, $message = '', $group = 'Other') {
+    $this->assert((bool) preg_match($pattern, $subject), $message, $group);
+  }
+  protected function assertNoPattern($pattern, $subject, $message = '', $group = 'Other') {
+    $this->assert(!((bool) preg_match($pattern, $subject)), $group);
+  }
+  function error($message, $type, $caller) {
+    $this->assert(SIMPLETEST_ASSERTION_ERROR, $message, $type, $caller);
+  }
+  function run() {
+    $this->setUp();
+    $methods = array();
+    foreach (get_class_methods(get_class($this)) as $method) {
+      if (strtolower(substr($method, 0, 4)) == 'test') {
+        $this->$method();
+      }
+    }
+    $this->tearDown();
+    return $this->test_stack;
+  }
+  protected function setUp() {
+    set_error_handler('simpletest_error_handler');
+  }
+  protected function tearDown() {
+    restore_error_handler();
+  }
+  protected function pass($message = NULL, $group = 'Other') {
+    $this->assert(TRUE, $message, $group);
+  }
+  protected function fail($message = NULL, $group = 'Other') {
+    $this->assert(FALSE, $message, $group);
+  }
+}
Index: modules/simpletest/drupal_test_suite.php
===================================================================
RCS file: modules/simpletest/drupal_test_suite.php
diff -N modules/simpletest/drupal_test_suite.php
--- modules/simpletest/drupal_test_suite.php	23 Apr 2008 17:49:50 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,147 +0,0 @@
-<?php
-// $Id: drupal_test_suite.php,v 1.2 2008/04/23 17:49:50 dries Exp $
-
-/**
- * Implements getTestInstances to allow access to the test objects from outside.
- */
-class DrupalTestSuite extends TestSuite {
-  var $_cleanupModules = array();
-
-  function DrupalTestSuite($label) {
-    $this->TestSuite($label);
-  }
-
-  /**
-   * @return
-   *   An array of instantiated tests that this GroupTests holds.
-   */
-  function getTestInstances() {
-    for ($i = 0, $count = count($this->_test_cases); $i < $count; $i++) {
-      if (is_string($this->_test_cases[$i])) {
-        $class = $this->_test_cases[$i];
-        $this->_test_cases[$i] = &new $class();
-      }
-    }
-    return $this->_test_cases;
-  }
-}
-
-class DrupalTests extends DrupalTestSuite {
-  /**
-   * Constructor for the DrupalTests class.
-   *
-   * @param array $class_list
-   *   List containing the classes of tests to be processed,
-   *   defaults to process all tests.
-   */
-  function DrupalTests($class_list = NULL) {
-    static $classes;
-    $this->DrupalTestSuite('Drupal Unit Tests');
-
-    // Tricky part to avoid double inclusion.
-    if (!$classes) {
-
-      $files = $this->getFiles();
-
-      $existing_classes = get_declared_classes();
-      foreach ($files as $file) {
-        include_once($file);
-      }
-      $classes = array_diff(get_declared_classes(), $existing_classes);
-    }
-    if (!is_null($class_list)) {
-      $classes = $class_list;
-    }
-    if (count($classes) == 0) {
-      drupal_set_message('No test cases found.', 'error');
-      return;
-    }
-    $groups = array();
-    foreach ($classes as $class) {
-      if ($this->classIsTest($class)) {
-        $this->_addClassToGroups($groups, $class);
-      }
-    }
-    foreach ($groups as $group_name => $group) {
-      $group_test = &new DrupalTestSuite($group_name);
-      foreach ($group as $key => $v) {
-        $group_test->addTestCase($group[$key]);
-      }
-      $this->addTestCase($group_test);
-    }
-  }
-
-  /**
-   * Adds a class to a groups array specified by the getInfo() of the group.
-   *
-   * @param array $groups
-   *   Group of categorized tests.
-   * @param string $class
-   *   Name of the class.
-   */
-  function _addClassToGroups(&$groups, $class) {
-    $test = &new $class();
-    if (method_exists($test, 'getInfo')) {
-      $info = $test->getInfo();
-      $groups[$info['group']][] = $test;
-    }
-  }
-
-  /**
-   * Invokes run() on all of the held test cases, instantiating
-   * them if necessary.
-   * The Drupal version uses paintHeader instead of paintGroupStart
-   * to avoid collapsing of the very top level.
-   *
-   * @param SimpleReporter $reporter
-   *   Current test reporter.
-   * @access public
-   */
-  function run(&$reporter) {
-    @set_time_limit(0);
-    ignore_user_abort(TRUE);
-
-    $this->cleanupBeforeRun();
-    $result = parent::run($reporter);
-    return $result;
-  }
-
-  /**
-   * Gets the files which contains the tests.
-   *
-   * @return
-   *   A list of files that contains the tests.
-   */
-  function getFiles() {
-    $files = array();
-    foreach (array_keys(module_rebuild_cache()) as $module) {
-      $module_path = drupal_get_path('module', $module);
-      $test = $module_path . "/$module.test";
-      if (file_exists($test)) {
-        $files[] = $test;
-      }
-    }
-    return $files;
-  }
-
-  /**
-   * Determines whether the class is a test.
-   *
-   * @return
-   *   TRUE / FALSE depending on whether the class is a test.
-   */
-  function classIsTest($class) {
-    return is_subclass_of($class, 'DrupalWebTestCase');
-  }
-
-  /**
-   * Called before the tests are run.
-   */
-  function cleanupBeforeRun() {
-    cache_clear_all();
-    // Disable devel output, check simpletest settings page.
-    if (!variable_get('simpletest_devel', FALSE)) {
-      $GLOBALS['devel_shutdown'] = FALSE;
-    }
-  }
-}
Index: modules/simpletest/drupal_unit_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_unit_test_case.php,v
retrieving revision 1.1
diff -u -p -r1.1 drupal_unit_test_case.php
--- modules/simpletest/drupal_unit_test_case.php	20 Apr 2008 18:34:43 -0000	1.1
+++ modules/simpletest/drupal_unit_test_case.php	29 Apr 2008 05:22:46 -0000
@@ -4,27 +4,12 @@
 /**
  * Test case Drupal unit tests.
  */
-class DrupalUnitTestCase extends UnitTestCase {
+class DrupalUnitTestCase extends DrupalTestCase {
   protected $created_temp_environment = FALSE;
   protected $db_prefix_original;
   protected $original_file_directory;
 
   /**
-   * Retrieve the test information from getInfo().
-   *
-   * @param string $label Name of the test to be used by the SimpleTest library.
-   */
-  function __construct($label = NULL) {
-    if (!$label) {
-      if (method_exists($this, 'getInfo')) {
-        $info  = $this->getInfo();
-        $label = $info['name'];
-      }
-    }
-    parent::__construct($label);
-  }
-
-  /**
    * Generates a random database prefix and runs the install scripts on the prefixed database.
    * After installation many caches are flushed and the internal browser is setup so that the page
    * requests will run on the new prefix. A temporary files directory is created with the same name
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.1
diff -u -p -r1.1 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	20 Apr 2008 18:34:43 -0000	1.1
+++ modules/simpletest/drupal_web_test_case.php	29 Apr 2008 05:22:46 -0000
@@ -4,7 +4,7 @@
 /**
  * Test case for typical Drupal tests.
  */
-class DrupalWebTestCase extends UnitTestCase {
+class DrupalWebTestCase extends DrupalTestCase {
   protected $_logged_in = FALSE;
   protected $_content;
   protected $plain_text;
@@ -19,21 +19,6 @@ class DrupalWebTestCase extends UnitTest
   protected $original_file_directory;
 
   /**
-   * Retrieve the test information from getInfo().
-   *
-   * @param string $label Name of the test to be used by the SimpleTest library.
-   */
-  function __construct($label = NULL) {
-    if (!$label) {
-      if (method_exists($this, 'getInfo')) {
-        $info  = $this->getInfo();
-        $label = $info['name'];
-      }
-    }
-    parent::__construct($label);
-  }
-
-  /**
    * Creates a node based on default settings.
    *
    * @param settings
@@ -401,19 +386,6 @@ class DrupalWebTestCase extends UnitTest
   }
 
   /**
-   * Set necessary reporter info.
-   */
-  function run(&$reporter) {
-    $arr = array('class' => get_class($this));
-    if (method_exists($this, 'getInfo')) {
-      $arr = array_merge($arr, $this->getInfo());
-    }
-    $reporter->test_info_stack[] = $arr;
-    parent::run($reporter);
-    array_pop($reporter->test_info_stack);
-  }
-
-  /**
    * Initializes the cURL connection and gets a session cookie.
    *
    * This function will add authentaticon headers as specified in
Index: modules/simpletest/dumper.php
===================================================================
RCS file: modules/simpletest/dumper.php
diff -N modules/simpletest/dumper.php
--- modules/simpletest/dumper.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-<?php
-// $Id: dumper.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- * Displays variables as text and does diffs.
- */
-class SimpleDumper {
-  /**
-   * Renders a variable in a shorter form than print_r().
-   *
-   * @param mixed $value      Variable to render as a string.
-   *
-   * @return string           Human readable string form.
-   * @access public
-   */
-  function describeValue($value) {
-    $type = $this->getType($value);
-    switch ($type) {
-      case "Null":
-        return "NULL";
-
-      case "Bool":
-        return "Boolean: ". ($value ? "true" : "false");
-
-      case "Array":
-        return "Array: ". count($value) ." items";
-
-      case "Object":
-        return "Object: of ". get_class($value);
-
-      case "String":
-        return "String: ". $this->clipString($value, 200);
-
-      default:
-        return "$type: $value";
-    }
-  }
-
-  /**
-   *    Gets the string representation of a type.
-   *    @param mixed $value    Variable to check against.
-   *    @return string         Type.
-   *    @access public
-   */
-  function getType($value) {
-    if (!isset($value)) {
-      return "Null";
-    }
-    $functions = array('bool', 'string', 'integer', 'float', 'array', 'resource', 'object');
-    foreach ($functions as $function) {
-      $function_name = 'is_'. $function;
-      if ($function_name($value)) {
-        return ucfirst($function);
-      }
-    }
-    return "Unknown";
-  }
-
- /**
-  *    Clips a string to a maximum length.
-  *    @param string $value         String to truncate.
-  *    @param integer $size         Minimum string size to show.
-  *    @param integer $position     Centre of string section.
-  *    @return string               Shortened version.
-  *    @access public
-  */
-  function clipString($value, $size, $position = 0) {
-    $length = strlen($value);
-    if ($length <= $size) {
-      return $value;
-    }
-    $position = min($position, $length);
-    $start = ($size / 2 > $position ? 0 : $position - $size / 2);
-    if ($start + $size > $length) {
-      $start = $length - $size;
-    }
-    $value = substr($value, $start, $size);
-    return ($start > 0 ? "..." : "") . $value . ($start + $size < $length ? "..." : "");
-  }
-}
Index: modules/simpletest/errors.php
===================================================================
RCS file: modules/simpletest/errors.php
diff -N modules/simpletest/errors.php
--- modules/simpletest/errors.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,240 +0,0 @@
-<?php
-// $Id: errors.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    Extension that traps errors into an error queue.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class SimpleErrorTrappingInvoker extends SimpleInvokerDecorator {
-  /**
-   *    Stores the invoker to wrap.
-   *    @param SimpleInvoker $invoker  Test method runner.
-   */
-  function SimpleErrorTrappingInvoker(&$invoker) {
-    $this->SimpleInvokerDecorator($invoker);
-  }
-
-  /**
-   *    Invokes a test method and dispatches any
-   *    untrapped errors. Called back from
-   *    the visiting runner.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function invoke($method) {
-    $queue = &$this->_createErrorQueue();
-    set_error_handler('SimpleTestErrorHandler');
-    parent::invoke($method);
-    restore_error_handler();
-    $queue->tally();
-  }
-
-  /**
-   *    Wires up the error queue for a single test.
-   *    @return SimpleErrorQueue    Queue connected to the test.
-   *    @access private
-   */
-  function & _createErrorQueue() {
-    $context = &SimpleTest::getContext();
-    $test    = &$this->getTestCase();
-    $queue   = &$context->get('SimpleErrorQueue');
-    $queue->setTestCase($test);
-    return $queue;
-  }
-}
-
-/**
- *    Error queue used to record trapped
- *    errors.
- *    @package  SimpleTest
- *    @subpackage  UnitTester
- */
-class SimpleErrorQueue {
-  var $_queue;
-  var $_expectation_queue;
-  var $_test;
-  var $_using_expect_style = false;
-
-  /**
-   *    Starts with an empty queue.
-   */
-  function SimpleErrorQueue() {
-    $this->clear();
-  }
-
-  /**
-   *    Discards the contents of the error queue.
-   *    @access public
-   */
-  function clear() {
-    $this->_queue = array();
-    $this->_expectation_queue = array();
-  }
-
-  /**
-   *    Sets the currently running test case.
-   *    @param SimpleTestCase $test    Test case to send messages to.
-   *    @access public
-   */
-  function setTestCase(&$test) {
-    $this->_test = &$test;
-  }
-
-  /**
-   *    Sets up an expectation of an error. If this is
-   *    not fulfilled at the end of the test, a failure
-   *    will occour. If the error does happen, then this
-   *    will cancel it out and send a pass message.
-   *    @param SimpleExpectation $expected    Expected error match.
-   *    @param string $message                Message to display.
-   *    @access public
-   */
-  function expectError($expected, $message) {
-    $this->_using_expect_style = true;
-    array_push($this->_expectation_queue, array($expected, $message));
-  }
-
-  /**
-   *    Adds an error to the front of the queue.
-   *    @param integer $severity       PHP error code.
-   *    @param string $content         Text of error.
-   *    @param string $filename        File error occoured in.
-   *    @param integer $line           Line number of error.
-   *    @access public
-   */
-  function add($severity, $content, $filename, $line) {
-    $content = str_replace('%', '%%', $content);
-    if ($this->_using_expect_style) {
-      $this->_testLatestError($severity, $content, $filename, $line);
-    }
-    else {
-      array_push($this->_queue, array($severity, $content, $filename, $line));
-    }
-  }
-
-  /**
-   *    Any errors still in the queue are sent to the test
-   *    case. Any unfulfilled expectations trigger failures.
-   *    @access public
-   */
-  function tally() {
-    while (list($severity, $message, $file, $line) = $this->extract()) {
-      $severity = $this->getSeverityAsString($severity);
-      $this->_test->error($severity, $message, $file, $line);
-    }
-    while (list($expected, $message) = $this->_extractExpectation()) {
-      $this->_test->assert($expected, false, "%s -> Expected error not caught");
-    }
-  }
-
-  /**
-   *    Tests the error against the most recent expected
-   *    error.
-   *    @param integer $severity       PHP error code.
-   *    @param string $content         Text of error.
-   *    @param string $filename        File error occoured in.
-   *    @param integer $line           Line number of error.
-   *    @access private
-   */
-  function _testLatestError($severity, $content, $filename, $line) {
-    if ($expectation = $this->_extractExpectation()) {
-      list($expected, $message) = $expectation;
-      $this->_test->assert($expected, $content, sprintf(
-          $message,
-          "%s -> PHP error [$content] severity [".
-          $this->getSeverityAsString($severity) .
-          "] in [$filename] line [$line]"));
-    }
-    else {
-      $this->_test->error($severity, $content, $filename, $line);
-    }
-  }
-
-  /**
-   *    Pulls the earliest error from the queue.
-   *    @return  mixed    False if none, or a list of error
-   *                    information. Elements are: severity
-   *                    as the PHP error code, the error message,
-   *                    the file with the error, the line number
-   *                    and a list of PHP super global arrays.
-   *    @access public
-   */
-  function extract() {
-    if (count($this->_queue)) {
-      return array_shift($this->_queue);
-    }
-    return false;
-  }
-
-  /**
-   *    Pulls the earliest expectation from the queue.
-   *    @return     SimpleExpectation    False if none.
-   *    @access private
-   */
-  function _extractExpectation() {
-    if (count($this->_expectation_queue)) {
-      return array_shift($this->_expectation_queue);
-    }
-    return false;
-  }
-
-  /**
-   *    Converts an error code into it's string
-   *    representation.
-   *    @param $severity  PHP integer error code.
-   *    @return           String version of error code.
-   *    @access public
-   *    @static
-   */
-  function getSeverityAsString($severity) {
-    static $map = array(
-      E_STRICT => 'E_STRICT',
-      E_ERROR => 'E_ERROR',
-      E_WARNING => 'E_WARNING',
-      E_PARSE => 'E_PARSE',
-      E_NOTICE => 'E_NOTICE',
-      E_CORE_ERROR => 'E_CORE_ERROR',
-      E_CORE_WARNING => 'E_CORE_WARNING',
-      E_COMPILE_ERROR => 'E_COMPILE_ERROR',
-      E_COMPILE_WARNING => 'E_COMPILE_WARNING',
-      E_USER_ERROR => 'E_USER_ERROR',
-      E_USER_WARNING => 'E_USER_WARNING',
-      E_USER_NOTICE => 'E_USER_NOTICE'
-    );
-    if (version_compare(phpversion(), '5.2.0', '>=')) {
-      $map[E_RECOVERABLE_ERROR] = 'E_RECOVERABLE_ERROR';
-    }
-    return $map[$severity];
-  }
-}
-
-/**
- *    Error handler that simply stashes any errors into the global
- *    error queue. Simulates the existing behaviour with respect to
- *    logging errors, but this feature may be removed in future.
- *    @param $severity        PHP error code.
- *    @param $message         Text of error.
- *    @param $filename        File error occoured in.
- *    @param $line            Line number of error.
- *    @param $super_globals   Hash of PHP super global arrays.
- *    @static
- *    @access public
- */
-function SimpleTestErrorHandler($severity, $message, $filename = null, $line = null, $super_globals = null, $mask = null) {
-  $severity = $severity & error_reporting();
-  if ($severity) {
-    restore_error_handler();
-    if (ini_get('log_errors')) {
-      $label = SimpleErrorQueue::getSeverityAsString($severity);
-      error_log("$label: $message in $filename on line $line");
-    }
-    $context = &SimpleTest::getContext();
-    $queue = &$context->get('SimpleErrorQueue');
-    $queue->add($severity, $message, $filename, $line);
-    set_error_handler('SimpleTestErrorHandler');
-  }
-  return true;
-}
-
-
Index: modules/simpletest/exceptions.php
===================================================================
RCS file: modules/simpletest/exceptions.php
diff -N modules/simpletest/exceptions.php
--- modules/simpletest/exceptions.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,171 +0,0 @@
-<?php
-// $Id: exceptions.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-class SimpleExceptionTrappingInvoker extends SimpleInvokerDecorator {
-
-  /**
-   * Stores the invoker to be wrapped.
-   * @param SimpleInvoker $invoker   Test method runner.
-   */
-  function SimpleExceptionTrappingInvoker($invoker) {
-    $this->SimpleInvokerDecorator($invoker);
-  }
-
-  /**
-   * Invokes a test method whilst trapping expected
-   * exceptions. Any left over unthrown exceptions
-   * are then reported as failures.
-   * @param string $method    Test method to call.
-   */
-  function invoke($method) {
-    $trap = SimpleTest::getContext()->get('SimpleExceptionTrap');
-    $trap->clear();
-    try {
-      parent::invoke($method);
-    }
-    catch (Exception $exception) {
-      if (!$trap->isExpected($this->getTestCase(), $exception)) {
-        $this->getTestCase()->exception($exception);
-      }
-      $trap->clear();
-      $this->_invoker->getTestCase()->tearDown();
-    }
-    if ($message = $trap->getOutstanding()) {
-      $this->getTestCase()->fail($message);
-    }
-  }
-}
-
-/**
- *    Tests exceptions either by type or the exact
- *    exception. This could be improved to accept
- *    a pattern expectation to test the error
- *    message, but that will have to come later.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class ExceptionExpectation extends SimpleExpectation {
-  private$expected;
-
-  /**
-   *    Sets up the conditions to test against.
-   *    If the expected value is a string, then
-   *    it will act as a test of the class name.
-   *    An exception as the comparison will
-   *    trigger an identical match. Writing this
-   *    down now makes it look doubly dumb. I hope
-   *    come up with a better scheme later.
-   *    @param mixed $expected   A class name or an actual
-   *                             exception to compare with.
-   *    @param string $message   Message to display.
-   */
-  function __construct($expected, $message = '%s') {
-    $this->expected = $expected;
-    parent::__construct($message);
-  }
-
-  /**
-   *    Carry out the test.
-   *    @param Exception $compare    Value to check.
-   *    @return boolean              True if matched.
-   */
-  function test($compare) {
-    if (is_string($this->expected)) {
-      return ($compare instanceof $this->expected);
-    }
-    if (get_class($compare) != get_class($this->expected)) {
-      return false;
-    }
-    return $compare->getMessage() == $this->expected->getMessage();
-  }
-
-  /**
-   *    Create the message to display describing the test.
-   *    @param Exception $compare     Exception to match.
-   *    @return string                Final message.
-   */
-  function testMessage($compare) {
-    if (is_string($this->expected)) {
-      return "Exception [". $this->describeException($compare) ."] should be type [". $this->expected ."]";
-    }
-    return "Exception [". $this->describeException($compare) ."] should match [". $this->describeException($this->expected) ."]";
-  }
-
-  /**
-   *    Summary of an Exception object.
-   *    @param Exception $compare     Exception to describe.
-   *    @return string                Text description.
-   */
-  protected function describeException($exception) {
-    return get_class($exception) .": ". $exception->getMessage();
-  }
-}
-
-/**
- *    Stores expected exceptions for when they
- *    get thrown. Saves the irritating try...catch
- *    block.
- *    @package  SimpleTest
- *    @subpackage  UnitTester
- */
-class SimpleExceptionTrap {
-  private$expected;
-  private$message;
-
-  /**
-   *    Clears down the queue ready for action.
-   */
-  function __construct() {
-    $this->clear();
-  }
-
-  /**
-   *    Sets up an expectation of an exception.
-   *    This has the effect of intercepting an
-   *    exception that matches.
-   *    @param SimpleExpectation $expected    Expected exception to match.
-   *    @param string $message                Message to display.
-   *    @access public
-   */
-  function expectException($expected = false, $message = '%s') {
-    if ($expected === false) {
-      $expected = new AnythingExpectation();
-    }
-    if (!SimpleExpectation::isExpectation($expected)) {
-      $expected = new ExceptionExpectation($expected);
-    }
-    $this->expected = $expected;
-    $this->message = $message;
-  }
-
-  /**
-   *    Compares the expected exception with any
-   *    in the queue. Issues a pass or fail and
-   *    returns the state of the test.
-   *    @param SimpleTestCase $test    Test case to send messages to.
-   *    @param Exception $exception    Exception to compare.
-   *    @return boolean                False on no match.
-   */
-  function isExpected($test, $exception) {
-    if ($this->expected) {
-      return $test->assert($this->expected, $exception, $this->message);
-    }
-    return false;
-  }
-
-  /**
-   *    Tests for any left over exception.
-   *    @return string/false     The failure message or false if none.
-   */
-  function getOutstanding() {
-    return sprintf($this->message, 'Failed to trap exception');
-  }
-
-  /**
-   *    Discards the contents of the error queue.
-   */
-  function clear() {
-    $this->expected = false;
-    $this->message = false;
-  }
-}
Index: modules/simpletest/expectation.php
===================================================================
RCS file: modules/simpletest/expectation.php
diff -N modules/simpletest/expectation.php
--- modules/simpletest/expectation.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,144 +0,0 @@
-<?php
-// $Id: expectation.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    Assertion that can display failure information.
- *    Also includes various helper methods.
- *    @package SimpleTest
- *    @subpackage UnitTester
- *    @abstract
- */
-class SimpleExpectation {
-  var $_dumper = false;
-  var $_message;
-
-  /**
-   *    Creates a dumper for displaying values and sets
-   *    the test message.
-   *    @param string $message    Customised message on failure.
-   */
-  function SimpleExpectation($message = '%s') {
-    $this->_message = $message;
-  }
-
-  /**
-   *    Tests the expectation. True if correct.
-   *    @param mixed $compare        Comparison value.
-   *    @return boolean              True if correct.
-   *    @access public
-   *    @abstract
-   */
-  function test($compare) {}
-
-  /**
-   *    Returns a human readable test message.
-   *    @param mixed $compare      Comparison value.
-   *    @return string             Description of success
-   *                               or failure.
-   *    @access public
-   *    @abstract
-   */
-  function testMessage($compare) {}
-
-  /**
-   *    Overlays the generated message onto the stored user
-   *    message. An additional message can be interjected.
-   *    @param mixed $compare        Comparison value.
-   *    @param SimpleDumper $dumper  For formatting the results.
-   *    @return string               Description of success
-   *                                 or failure.
-   *    @access public
-   */
-  function overlayMessage($compare, $dumper) {
-    $this->_dumper = $dumper;
-    return sprintf($this->_message, $this->testMessage($compare));
-  }
-
-  /**
-   *    Accessor for the dumper.
-   *    @return SimpleDumper    Current value dumper.
-   *    @access protected
-   */
-  function &_getDumper() {
-    if (!$this->_dumper) {
-      $dumper = &new SimpleDumper();
-      return $dumper;
-    }
-    return $this->_dumper;
-  }
-
-  /**
-   *    Test to see if a value is an expectation object.
-   *    A useful utility method.
-   *    @param mixed $expectation    Hopefully an Epectation
-   *                                 class.
-   *    @return boolean              True if descended from
-   *                                 this class.
-   *    @access public
-   *    @static
-   */
-  function isExpectation($expectation) {
-    return is_object($expectation) && is_a($expectation, 'SimpleExpectation');
-  }
-}
-
-/**
- *    A wildcard expectation always matches.
- *    @package SimpleTest
- *    @subpackage MockObjects
- */
-class AnythingExpectation extends SimpleExpectation {
-
-  /**
-   *    Tests the expectation. Always true.
-   *    @param mixed $compare  Ignored.
-   *    @return boolean        True.
-   *    @access public
-   */
-  function test($compare) {
-    return true;
-  }
-
-  /**
-   *    Returns a human readable test message.
-   *    @param mixed $compare      Comparison value.
-   *    @return string             Description of success
-   *                               or failure.
-   *    @access public
-   */
-  function testMessage($compare) {
-    $dumper = &$this->_getDumper();
-    return 'Anything always matches ['. $dumper->describeValue($compare) .']';
-  }
-}
-
-/**
- *    An expectation that passes on boolean true.
- *    @package SimpleTest
- *    @subpackage MockObjects
- */
-class TrueExpectation extends SimpleExpectation {
-
-  /**
-   *    Tests the expectation.
-   *    @param mixed $compare  Should be true.
-   *    @return boolean        True on match.
-   *    @access public
-   */
-  function test($compare) {
-    return (boolean)$compare;
-  }
-
-  /**
-   *    Returns a human readable test message.
-   *    @param mixed $compare      Comparison value.
-   *    @return string             Description of success
-   *                               or failure.
-   *    @access public
-   */
-  function testMessage($compare) {
-    $dumper = &$this->_getDumper();
-    return 'Expected true, got ['. $dumper->describeValue($compare) .']';
-  }
-}
-
Index: modules/simpletest/invoker.php
===================================================================
RCS file: modules/simpletest/invoker.php
diff -N modules/simpletest/invoker.php
--- modules/simpletest/invoker.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,119 +0,0 @@
-<?php
-// $Id: invoker.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    This is called by the class runner to run a
- *    single test method. Will also run the setUp()
- *    and tearDown() methods.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class SimpleInvoker {
-  var $_test_case;
-
-  /**
-   *    Stashes the test case for later.
-   *    @param SimpleTestCase $test_case  Test case to run.
-   */
-  function SimpleInvoker(&$test_case) {
-    $this->_test_case = &$test_case;
-  }
-
-  /**
-   *    Accessor for test case being run.
-   *    @return SimpleTestCase    Test case.
-   *    @access public
-   */
-  function &getTestCase() {
-    return $this->_test_case;
-  }
-
-  /**
-   *    Runs test level set up. Used for changing
-   *    the mechanics of base test cases.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function before($method) {
-    $this->_test_case->before($method);
-  }
-
-  /**
-   *    Invokes a test method and buffered with setUp()
-   *    and tearDown() calls.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function invoke($method) {
-    $this->_test_case->setUp();
-    $this->_test_case->$method();
-    $this->_test_case->tearDown();
-  }
-
-  /**
-   *    Runs test level clean up. Used for changing
-   *    the mechanics of base test cases.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function after($method) {
-    $this->_test_case->after($method);
-  }
-}
-
-/**
- *    Do nothing decorator. Just passes the invocation
- *    straight through.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class SimpleInvokerDecorator {
-  var $_invoker;
-
-  /**
-   *    Stores the invoker to wrap.
-   *    @param SimpleInvoker $invoker  Test method runner.
-   */
-  function SimpleInvokerDecorator(&$invoker) {
-    $this->_invoker = &$invoker;
-  }
-
-  /**
-   *    Accessor for test case being run.
-   *    @return SimpleTestCase    Test case.
-   *    @access public
-   */
-  function &getTestCase() {
-    return $this->_invoker->getTestCase();
-  }
-
-  /**
-   *    Runs test level set up. Used for changing
-   *    the mechanics of base test cases.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function before($method) {
-    $this->_invoker->before($method);
-  }
-
-  /**
-   *    Invokes a test method and buffered with setUp()
-   *    and tearDown() calls.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function invoke($method) {
-    $this->_invoker->invoke($method);
-  }
-
-  /**
-   *    Runs test level clean up. Used for changing
-   *    the mechanics of base test cases.
-   *    @param string $method    Test method to call.
-   *    @access public
-   */
-  function after($method) {
-    $this->_invoker->after($method);
-  }
-}
Index: modules/simpletest/reporter.php
===================================================================
RCS file: modules/simpletest/reporter.php
diff -N modules/simpletest/reporter.php
--- modules/simpletest/reporter.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,283 +0,0 @@
-<?php
-// $Id: reporter.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    Sample minimal test displayer. Generates only
- *    failure messages and a pass count.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class HtmlReporter extends SimpleReporter {
-  var $_character_set;
-
-  /**
-   *    Does nothing yet. The first output will
-   *    be sent on the first test start. For use
-   *    by a web browser.
-   *    @access public
-   */
-  function HtmlReporter($character_set = 'ISO-8859-1') {
-    $this->SimpleReporter();
-    $this->_character_set = $character_set;
-  }
-
-  /**
-   *    Paints the top of the web page setting the
-   *    title to the name of the starting test.
-   *    @param string $test_name      Name class of test.
-   *    @access public
-   */
-  function paintHeader($test_name) {
-    $this->sendNoCacheHeaders();
-    print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
-    print "<html>\n<head>\n<title>$test_name</title>\n";
-    print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=". $this->_character_set ."\">\n";
-    print "<style type=\"text/css\">\n";
-    print $this->_getCss() ."\n";
-    print "</style>\n";
-    print "</head>\n<body>\n";
-    print "<h1>$test_name</h1>\n";
-    flush();
-  }
-
-  /**
-   *    Send the headers necessary to ensure the page is
-   *    reloaded on every request. Otherwise you could be
-   *    scratching your head over out of date test data.
-   *    @access public
-   *    @static
-   */
-  function sendNoCacheHeaders() {
-    if (!headers_sent()) {
-      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-      header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
-      header("Cache-Control: no-store, no-cache, must-revalidate");
-      header("Cache-Control: post-check=0, pre-check=0", false);
-      header("Pragma: no-cache");
-    }
-  }
-
-  /**
-   *    Paints the CSS. Add additional styles here.
-   *    @return string            CSS code as text.
-   *    @access protected
-   */
-  function _getCss() {
-    return ".fail { background-color: inherit; color: red; }".".pass { background-color: inherit; color: green; }"." pre { background-color: lightgray; color: inherit; }";
-  }
-
-  /**
-   *    Paints the end of the test with a summary of
-   *    the passes and failures.
-   *    @param string $test_name        Name class of test.
-   *    @access public
-   */
-  function paintFooter($test_name) {
-    $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
-    print "<div style=\"";
-    print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
-    print "\">";
-    print $this->getTestCaseProgress() ."/". $this->getTestCaseCount();
-    print " test cases complete:\n";
-    print "<strong>". $this->getPassCount() ."</strong> passes, ";
-    print "<strong>". $this->getFailCount() ."</strong> fails and ";
-    print "<strong>". $this->getExceptionCount() ."</strong> exceptions.";
-    print "</div>\n";
-    print "</body>\n</html>\n";
-  }
-
-  /**
-   *    Paints the test failure with a breadcrumbs
-   *    trail of the nesting test suites below the
-   *    top level test.
-   *    @param string $message    Failure message displayed in
-   *                              the context of the other tests.
-   *    @access public
-   */
-  function paintFail($message) {
-    parent::paintFail($message);
-    print "<span class=\"fail\">Fail</span>: ";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print implode(" -&gt; ", $breadcrumb);
-    print " -&gt; ". $this->_htmlEntities($message) ."<br />\n";
-  }
-
-  /**
-   *    Paints a PHP error.
-   *    @param string $message        Message is ignored.
-   *    @access public
-   */
-  function paintError($message) {
-    parent::paintError($message);
-    print "<span class=\"fail\">Exception</span>: ";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print implode(" -&gt; ", $breadcrumb);
-    print " -&gt; <strong>". $this->_htmlEntities($message) ."</strong><br />\n";
-  }
-
-  /**
-   *    Paints a PHP exception.
-   *    @param Exception $exception        Exception to display.
-   *    @access public
-   */
-  function paintException($exception) {
-    parent::paintException($exception);
-    print "<span class=\"fail\">Exception</span>: ";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print implode(" -&gt; ", $breadcrumb);
-    $message = 'Unexpected exception of type ['. get_class($exception) .'] with message ['. $exception->getMessage() .'] in ['. $exception->getFile() .' line '. $exception->getLine() .']';
-    print " -&gt; <strong>". $this->_htmlEntities($message) ."</strong><br />\n";
-  }
-
-  /**
-   *    Prints the message for skipping tests.
-   *    @param string $message    Text of skip condition.
-   *    @access public
-   */
-  function paintSkip($message) {
-    parent::paintSkip($message);
-    print "<span class=\"pass\">Skipped</span>: ";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print implode(" -&gt; ", $breadcrumb);
-    print " -&gt; ". $this->_htmlEntities($message) ."<br />\n";
-  }
-
-  /**
-   *    Paints formatted text such as dumped variables.
-   *    @param string $message        Text to show.
-   *    @access public
-   */
-  function paintFormattedMessage($message) {
-    print '<pre>'. $this->_htmlEntities($message) .'</pre>';
-  }
-
-  /**
-   *    Character set adjusted entity conversion.
-   *    @param string $message    Plain text or Unicode message.
-   *    @return string            Browser readable message.
-   *    @access protected
-   */
-  function _htmlEntities($message) {
-    return htmlentities($message, ENT_COMPAT, $this->_character_set);
-  }
-}
-
-/**
- *    Sample minimal test displayer. Generates only
- *    failure messages and a pass count. For command
- *    line use. I've tried to make it look like JUnit,
- *    but I wanted to output the errors as they arrived
- *    which meant dropping the dots.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class TextReporter extends SimpleReporter {
-
-  /**
-   *    Does nothing yet. The first output will
-   *    be sent on the first test start.
-   *    @access public
-   */
-  function TextReporter() {
-    $this->SimpleReporter();
-  }
-
-  /**
-   *    Paints the title only.
-   *    @param string $test_name        Name class of test.
-   *    @access public
-   */
-  function paintHeader($test_name) {
-    if (!SimpleReporter::inCli()) {
-      header('Content-type: text/plain');
-    }
-    print "$test_name\n";
-    flush();
-  }
-
-  /**
-   *    Paints the end of the test with a summary of
-   *    the passes and failures.
-   *    @param string $test_name        Name class of test.
-   *    @access public
-   */
-  function paintFooter($test_name) {
-    if ($this->getFailCount() + $this->getExceptionCount() == 0) {
-      print "OK\n";
-    }
-    else {
-      print "FAILURES!!!\n";
-    }
-    print "Test cases run: ". $this->getTestCaseProgress() ."/". $this->getTestCaseCount() .", Passes: ". $this->getPassCount() .", Failures: ". $this->getFailCount() .", Exceptions: ". $this->getExceptionCount() ."\n";
-  }
-
-  /**
-   *    Paints the test failure as a stack trace.
-   *    @param string $message    Failure message displayed in
-   *                              the context of the other tests.
-   *    @access public
-   */
-  function paintFail($message) {
-    parent::paintFail($message);
-    print $this->getFailCount() .") $message\n";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print "\tin ". implode("\n\tin ", array_reverse($breadcrumb));
-    print "\n";
-  }
-
-  /**
-   *    Paints a PHP error or exception.
-   *    @param string $message        Message to be shown.
-   *    @access public
-   *    @abstract
-   */
-  function paintError($message) {
-    parent::paintError($message);
-    print "Exception ". $this->getExceptionCount() ."!\n$message\n";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print "\tin ". implode("\n\tin ", array_reverse($breadcrumb));
-    print "\n";
-  }
-
-  /**
-   *    Paints a PHP error or exception.
-   *    @param Exception $exception      Exception to describe.
-   *    @access public
-   *    @abstract
-   */
-  function paintException($exception) {
-    parent::paintException($exception);
-    $message = 'Unexpected exception of type ['. get_class($exception) .'] with message ['. $exception->getMessage() .'] in ['. $exception->getFile() .' line '. $exception->getLine() .']';
-    print "Exception ". $this->getExceptionCount() ."!\n$message\n";
-    $breadcrumb = $this->getTestList();
-    array_shift($breadcrumb);
-    print "\tin ". implode("\n\tin ", array_reverse($breadcrumb));
-    print "\n";
-  }
-
-  /**
-   *    Prints the message for skipping tests.
-   *    @param string $message    Text of skip condition.
-   *    @access public
-   */
-  function paintSkip($message) {
-    parent::paintSkip($message);
-    print "Skip: $message\n";
-  }
-
-  /**
-   *    Paints formatted text such as dumped variables.
-   *    @param string $message        Text to show.
-   *    @access public
-   */
-  function paintFormattedMessage($message) {
-    print "$message\n";
-    flush();
-  }
-}
Index: modules/simpletest/scorer.php
===================================================================
RCS file: modules/simpletest/scorer.php
diff -N modules/simpletest/scorer.php
--- modules/simpletest/scorer.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,413 +0,0 @@
-<?php
-// $Id: scorer.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- *    Can recieve test events and display them. Display
- *    is achieved by making display methods available
- *    and visiting the incoming event.
- *    @package SimpleTest
- *    @subpackage UnitTester
- *    @abstract
- */
-class SimpleScorer {
-  var$_passes;
-  var$_fails;
-  var$_exceptions;
-  var$_is_dry_run;
-
-  /**
-   *    Starts the test run with no results.
-   *    @access public
-   */
-  function SimpleScorer() {
-    $this->_passes     = 0;
-    $this->_fails      = 0;
-    $this->_exceptions = 0;
-    $this->_is_dry_run = false;
-  }
-
-  /**
-   *    Signals that the next evaluation will be a dry
-   *    run. That is, the structure events will be
-   *    recorded, but no tests will be run.
-   *    @param boolean $is_dry        Dry run if true.
-   *    @access public
-   */
-  function makeDry($is_dry = true) {
-    $this->_is_dry_run = $is_dry;
-  }
-
-  /**
-   *    The reporter has a veto on what should be run.
-   *    @param string $test_case_name  name of test case.
-   *    @param string $method          Name of test method.
-   *    @access public
-   */
-  function shouldInvoke($test_case_name, $method) {
-    return !$this->_is_dry_run;
-  }
-
-  /**
-   *    Can wrap the invoker in preperation for running
-   *    a test.
-   *    @param SimpleInvoker $invoker   Individual test runner.
-   *    @return SimpleInvoker           Wrapped test runner.
-   *    @access public
-   */
-  function & createInvoker(&$invoker) {
-    return $invoker;
-  }
-
-  /**
-   *    Accessor for current status. Will be false
-   *    if there have been any failures or exceptions.
-   *    Used for command line tools.
-   *    @return boolean        True if no failures.
-   *    @access public
-   */
-  function getStatus() {
-    if ($this->_exceptions + $this->_fails > 0) {
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   *    Paints the start of a group test.
-   *    @param string $test_name     Name of test or other label.
-   *    @param integer $size         Number of test cases starting.
-   *    @access public
-   */
-  function paintGroupStart($test_name, $size) {}
-
-  /**
-   *    Paints the end of a group test.
-   *    @param string $test_name     Name of test or other label.
-   *    @access public
-   */
-  function paintGroupEnd($test_name) {}
-
-  /**
-   *    Paints the start of a test case.
-   *    @param string $test_name     Name of test or other label.
-   *    @access public
-   */
-  function paintCaseStart($test_name) {}
-
-  /**
-   *    Paints the end of a test case.
-   *    @param string $test_name     Name of test or other label.
-   *    @access public
-   */
-  function paintCaseEnd($test_name) {}
-
-  /**
-   *    Paints the start of a test method.
-   *    @param string $test_name     Name of test or other label.
-   *    @access public
-   */
-  function paintMethodStart($test_name) {}
-
-  /**
-   *    Paints the end of a test method.
-   *    @param string $test_name     Name of test or other label.
-   *    @access public
-   */
-  function paintMethodEnd($test_name) {}
-
-  /**
-   *    Increments the pass count.
-   *    @param string $message        Message is ignored.
-   *    @access public
-   */
-  function paintPass($message) {
-    $this->_passes++;
-  }
-
-  /**
-   *    Increments the fail count.
-   *    @param string $message        Message is ignored.
-   *    @access public
-   */
-  function paintFail($message) {
-    $this->_fails++;
-  }
-
-  /**
-   *    Deals with PHP 4 throwing an error.
-   *    @param string $message    Text of error formatted by
-   *                              the test case.
-   *    @access public
-   */
-  function paintError($message) {
-    $this->_exceptions++;
-  }
-
-  /**
-   *    Deals with PHP 5 throwing an exception.
-   *    @param Exception $exception    The actual exception thrown.
-   *    @access public
-   */
-  function paintException($exception) {
-    $this->_exceptions++;
-  }
-
-  /**
-   *    Prints the message for skipping tests.
-   *    @param string $message    Text of skip condition.
-   *    @access public
-   */
-  function paintSkip($message) {}
-
-  /**
-   *    Accessor for the number of passes so far.
-   *    @return integer       Number of passes.
-   *    @access public
-   */
-  function getPassCount() {
-    return $this->_passes;
-  }
-
-  /**
-   *    Accessor for the number of fails so far.
-   *    @return integer       Number of fails.
-   *    @access public
-   */
-  function getFailCount() {
-    return $this->_fails;
-  }
-
-  /**
-   *    Accessor for the number of untrapped errors
-   *    so far.
-   *    @return integer       Number of exceptions.
-   *    @access public
-   */
-  function getExceptionCount() {
-    return $this->_exceptions;
-  }
-
-  /**
-   *    Paints a simple supplementary message.
-   *    @param string $message        Text to display.
-   *    @access public
-   */
-  function paintMessage($message) {}
-
-  /**
-   *    Paints a formatted ASCII message such as a
-   *    variable dump.
-   *    @param string $message        Text to display.
-   *    @access public
-   */
-  function paintFormattedMessage($message) {}
-
-  /**
-   *    By default just ignores user generated events.
-   *    @param string $type        Event type as text.
-   *    @param mixed $payload      Message or object.
-   *    @access public
-   */
-  function paintSignal($type, $payload) {}
-}
-
-/**
- *    Recipient of generated test messages that can display
- *    page footers and headers. Also keeps track of the
- *    test nesting. This is the main base class on which
- *    to build the finished test (page based) displays.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class SimpleReporter extends SimpleScorer {
-  var$_test_stack;
-  var$_size;
-  var$_progress;
-
-  /**
-   *    Starts the display with no results in.
-   *    @access public
-   */
-  function SimpleReporter() {
-    $this->SimpleScorer();
-    $this->_test_stack = array();
-    $this->_size       = null;
-    $this->_progress   = 0;
-  }
-
-  /**
-   *    Gets the formatter for variables and other small
-   *    generic data items.
-   *    @return SimpleDumper          Formatter.
-   *    @access public
-   */
-  function getDumper() {
-    return new SimpleDumper();
-  }
-
-  /**
-   *    Paints the start of a group test. Will also paint
-   *    the page header and footer if this is the
-   *    first test. Will stash the size if the first
-   *    start.
-   *    @param string $test_name   Name of test that is starting.
-   *    @param integer $size       Number of test cases starting.
-   *    @access public
-   */
-  function paintGroupStart($test_name, $size) {
-    if (!isset($this->_size)) {
-      $this->_size = $size;
-    }
-    if (count($this->_test_stack) == 0) {
-      $this->paintHeader($test_name);
-    }
-    $this->_test_stack[] = $test_name;
-  }
-
-  /**
-   *    Paints the end of a group test. Will paint the page
-   *    footer if the stack of tests has unwound.
-   *    @param string $test_name   Name of test that is ending.
-   *    @param integer $progress   Number of test cases ending.
-   *    @access public
-   */
-  function paintGroupEnd($test_name) {
-    array_pop($this->_test_stack);
-    if (count($this->_test_stack) == 0) {
-      $this->paintFooter($test_name);
-    }
-  }
-
-  /**
-   *    Paints the start of a test case. Will also paint
-   *    the page header and footer if this is the
-   *    first test. Will stash the size if the first
-   *    start.
-   *    @param string $test_name   Name of test that is starting.
-   *    @access public
-   */
-  function paintCaseStart($test_name) {
-    if (!isset($this->_size)) {
-      $this->_size = 1;
-    }
-    if (count($this->_test_stack) == 0) {
-      $this->paintHeader($test_name);
-    }
-    $this->_test_stack[] = $test_name;
-  }
-
-  /**
-   *    Paints the end of a test case. Will paint the page
-   *    footer if the stack of tests has unwound.
-   *    @param string $test_name   Name of test that is ending.
-   *    @access public
-   */
-  function paintCaseEnd($test_name) {
-    $this->_progress++;
-    array_pop($this->_test_stack);
-    if (count($this->_test_stack) == 0) {
-      $this->paintFooter($test_name);
-    }
-  }
-
-  /**
-   *    Paints the start of a test method.
-   *    @param string $test_name   Name of test that is starting.
-   *    @access public
-   */
-  function paintMethodStart($test_name) {
-    $this->_test_stack[] = $test_name;
-  }
-
-  /**
-   *    Paints the end of a test method. Will paint the page
-   *    footer if the stack of tests has unwound.
-   *    @param string $test_name   Name of test that is ending.
-   *    @access public
-   */
-  function paintMethodEnd($test_name) {
-    array_pop($this->_test_stack);
-  }
-
-  /**
-   *    Paints the test document header.
-   *    @param string $test_name     First test top level
-   *                                 to start.
-   *    @access public
-   *    @abstract
-   */
-  function paintHeader($test_name) {}
-
-  /**
-   *    Paints the test document footer.
-   *    @param string $test_name        The top level test.
-   *    @access public
-   *    @abstract
-   */
-  function paintFooter($test_name) {}
-
-  /**
-   *    Accessor for internal test stack. For
-   *    subclasses that need to see the whole test
-   *    history for display purposes.
-   *    @return array     List of methods in nesting order.
-   *    @access public
-   */
-  function getTestList() {
-    return $this->_test_stack;
-  }
-
-  /**
-   *    Accessor for total test size in number
-   *    of test cases. Null until the first
-   *    test is started.
-   *    @return integer   Total number of cases at start.
-   *    @access public
-   */
-  function getTestCaseCount() {
-    return $this->_size;
-  }
-
-  /**
-   *    Accessor for the number of test cases
-   *    completed so far.
-   *    @return integer   Number of ended cases.
-   *    @access public
-   */
-  function getTestCaseProgress() {
-    return $this->_progress;
-  }
-
-  /**
-   *    Static check for running in the comand line.
-   *    @return boolean        True if CLI.
-   *    @access public
-   *    @static
-   */
-  function inCli() {
-    return php_sapi_name() == 'cli';
-  }
-}
-
-/**
- *    For modifying the behaviour of the visual reporters.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class SimpleReporterDecorator {
-  var $_reporter;
-
-  /**
-   *    Mediates between the reporter and the test case.
-   *    @param SimpleScorer $reporter       Reporter to receive events.
-   */
-  function __construct(&$reporter) {
-    $this->_reporter = &$reporter;
-  }
-
-  function __call($method, $arguments) {
-    if (method_exists($this->_reporter, $method)) {
-      return call_user_func_array($this->_reporter->$method, $arguments);
-    }
-  }
-}
Index: modules/simpletest/simpletest.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.css,v
retrieving revision 1.1
diff -u -p -r1.1 simpletest.css
--- modules/simpletest/simpletest.css	20 Apr 2008 18:23:29 -0000	1.1
+++ modules/simpletest/simpletest.css	29 Apr 2008 05:22:46 -0000
@@ -1,9 +1,11 @@
 /* $Id: simpletest.css,v 1.1 2008/04/20 18:23:29 dries Exp $ */
 
-/* Addon for the simpletest module */
-#simpletest {
-}
 /* Test Table */
+#simpletest-form-table .description {
+  margin: 0;
+  padding: 0;
+}
+
 th.simpletest_run {
   width: 50px;
 }
@@ -24,6 +26,7 @@ table#simpletest-form-table tr.simpletes
   background-color: #EDF5FA !important;
 }
 
+/* Test Results */
 div.simpletest-pass {
   background: #b6ffb6;
 }
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.1
diff -u -p -r1.1 simpletest.module
--- modules/simpletest/simpletest.module	20 Apr 2008 18:23:29 -0000	1.1
+++ modules/simpletest/simpletest.module	29 Apr 2008 05:22:46 -0000
@@ -1,6 +1,10 @@
 <?php
 // $Id: simpletest.module,v 1.1 2008/04/20 18:23:29 dries Exp $
 
+define('SIMPLETEST_ASSERTION_PASS', 'pass');
+define('SIMPLETEST_ASSERTION_FAIL', 'fail');
+define('SIMPLETEST_ASSERTION_ERROR', 'exception');
+
 /**
  * Implementation of hook_help().
  */
@@ -22,7 +26,8 @@ function simpletest_help($path, $arg) {
 function simpletest_menu() {
   $items['admin/build/testing'] = array(
     'title' => 'Testing',
-    'page callback' => 'simpletest_entrypoint',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('simpletest_test_form'),
     'description' => 'Run tests against Drupal core and your active modules. These tests help assure that your site code is working as designed.',
     'access arguments' => array('administer unit tests'),
   );
@@ -50,7 +55,7 @@ function simpletest_perm() {
  */
 function simpletest_theme() {
   return array(
-    'simpletest_overview_form' => array(
+    'simpletest_test_form' => array(
       'arguments' => array('form' => NULL)
     ),
   );
@@ -61,93 +66,44 @@ function simpletest_theme() {
  * @return boolean TRUE if the load succeeded
  */
 function simpletest_load() {
-  global $user;
   static $loaded;
   if (!$loaded) {
     $loaded = TRUE;
-    if ($user->uid != 1) {
-      drupal_set_message(t('It is strongly suggested to run the tests with the first user!'));
-    }
     $path = drupal_get_path('module', 'simpletest') .'/';
-    foreach (array('simpletest.php', 'unit_tester.php', 'reporter.php', 'drupal_reporter.php', 'drupal_web_test_case.php', 'drupal_test_suite.php') as $file) {
+    foreach (array('drupal_test_case.php', 'drupal_unit_test_case.php', 'drupal_web_test_case.php') as $file) {
       require_once($path . $file);
     }
   }
 }
 
 /**
- * Menu callback for both running tests and listing possible tests
+ * Form callback;  make the form to run tests
  */
-function simpletest_entrypoint() {
+function simpletest_test_form(&$form_state) {
   simpletest_load();
-  drupal_add_css(drupal_get_path('module', 'simpletest') .'/simpletest.css', 'module');
-  drupal_add_js(drupal_get_path('module', 'simpletest') .'/simpletest.js', 'module');
-  $output = drupal_get_form('simpletest_overview_form');
-
-  if (simpletest_running_output()) {
-    return simpletest_running_output() . $output;
-  }
-  else {
-    return $output;
-  }
-}
-
-function simpletest_running_output($output = NULL) {
-  static $o;
-  if ($output != NULL) {
-    $o = $output;
-  }
-  return $o;
-}
+  $form = array();
+  $tests = simpletest_categorize_tests(simpletest_get_all_tests());
 
-/**
- * Form callback;  make the form to run tests
- */
-function simpletest_overview_form() {
-  $output = array(
-    '#theme' => 'simpletest_overview_form'
-  );
-
-  $total_test = &simpletest_get_total_test();
-
-  $test_instances = $total_test->getTestInstances();
-  uasort($test_instances, 'simpletest_compare_instances');
-
-  foreach ($test_instances as $group_test) {
-    $group = array();
-    $tests = $group_test->getTestInstances();
-    $group_class = str_replace(' ', '-', strtolower($group_test->getLabel()));
-    $group['tests'] = array(
-      '#type' => 'fieldset',
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE,
-      '#title' => 'Tests',
-      '#attributes' => array('class' => $group_class),
-    );
-    foreach ($tests as $test) {
+  foreach ($tests as $group_name => $test_group) {
+    foreach ($test_group as $test) {
       $test_info = $test->getInfo();
-      $group['tests'][get_class($test)] = array(
+      $test_class = get_class($test);
+      $form['tests'][$group_name][$test_class] = array(
         '#type' => 'checkbox',
-        '#title' => $test_info['name'],
-        '#default_value' => 0,
+        '#name' => $test_class,
+        '#title' => $test_class,
         '#description' => $test_info['description'],
       );
     }
-    $output[] = $group + array(
-      '#type' => 'fieldset',
-      '#collapsible' => FALSE,
-      '#title' => $group_test->getLabel(),
-      '#attributes' => array('class' => 'all-tests'),
-    );
   }
 
-  $output['run'] = array(
+  $form['run'] = array(
     '#type' => 'fieldset',
     '#collapsible' => FALSE,
     '#collapsed' => FALSE,
     '#title' => t('Run tests'),
   );
-  $output['run']['running_options'] = array(
+  $form['run']['running_options'] = array(
     '#type' => 'radios',
     '#default_value' => 'selected_tests',
     '#options' => array(
@@ -155,25 +111,27 @@ function simpletest_overview_form() {
       'selected_tests' => t('Run selected tests'),
     ),
   );
-  $output['run']['op'] = array(
+  $form['run']['op'] = array(
     '#type' => 'submit',
     '#value' => t('Run tests'),
-    '#submit' => array('simpletest_run_selected_tests')
+    '#submit' => array('simpletest_test_form_submit'),
   );
 
-  $output['reset'] = array(
+  $form['reset'] = array(
     '#type' => 'fieldset',
     '#collapsible' => FALSE,
     '#collapsed' => FALSE,
     '#title' => t('Clean test environment'),
     '#description' => t('Remove tables with the prefix "simpletest" and temporary directories that are left over from tests that crashed.')
   );
-  $output['reset']['op'] = array(
+  $form['reset']['op'] = array(
     '#type' => 'submit',
     '#value' => t('Clean environment'),
-    '#submit' => array('simpletest_clean_environment')
+    '#submit' => array('simpletest_clean_environment'),
   );
-  return $output;
+  $form['pr'] = array('#value' => '<pre>'. print_r($form_state, 1) .'</pre>');
+  $form['#theme'] = 'simpletest_test_form';
+  return $form;
 }
 
 /**
@@ -181,7 +139,9 @@ function simpletest_overview_form() {
  *
  * @ingroup themeable
  */
-function theme_simpletest_overview_form($form) {
+function theme_simpletest_test_form($form) {
+  drupal_add_css(drupal_get_path('module', 'simpletest') .'/simpletest.css', 'module');
+  drupal_add_js(drupal_get_path('module', 'simpletest') .'/simpletest.js', 'module');
   $header = array(
     array('data' => t('Run'), 'class' => 'simpletest_run checkbox'),
     array('data' => t('Test'), 'class' => 'simpletest_test'),
@@ -196,41 +156,44 @@ function theme_simpletest_overview_form(
 
   // Go through each test group and create a row:
   $rows = array();
-  foreach (element_children($form) as $gid) {
-    if (isset($form[$gid]['tests'])) {
-      $element = &$form[$gid];
-      $test_class = strtolower(trim(preg_replace("/[^\w\d]/", "-",$element["#title"])));
-
-      $row = array();
-      $row[] = array('id' => $test_class, 'class' => 'simpletest-select-all');
-      $row[] = array(
-        'data' =>  '<div class="simpletest-image" id="simpletest-test-group-'. $test_class .'">'. $js['images'][0] .'</div>&nbsp;<label for="'. $test_class .'-select-all" class="simpletest-group-label">'. $element['#title'] .'</label>',
-        'style' => 'font-weight: bold;'
-      );
+  foreach (element_children($form['tests']) as $key) {
+    $element = &$form['tests'][$key];
+    $test_class = strtolower(trim(preg_replace("/[^\w\d]/", "-", $key)));
+    
+    $row = array();
+    $row[] = array('id' => $test_class, 'class' => 'simpletest-select-all');
+    $row[] = array(
+      'data' =>  '<div class="simpletest-image" id="simpletest-test-group-'. $test_class .'">'. $js['images'][0] .'</div>&nbsp;<label for="'. $test_class .'-select-all" class="simpletest-group-label">'. $key .'</label>',
+      'style' => 'font-weight: bold;'
+    );
+    if (isset($element['#description'])) {
       $row[] = $element['#description'];
-      $rows[] = array('data' => $row, 'class' => 'simpletest-group');
-      $current_js = array('testClass' => $test_class .'-test', 'testNames' => array(), 'imageDirection' => 0, 'clickActive' => FALSE);
-
-      // Go through each test in the group and create table rows setting them to invisible:
-      foreach (element_children($element['tests']) as $test_name) {
-        $current_js['testNames'][] = 'edit-'. $test_name;
-        $test = $element['tests'][$test_name];
-        foreach (array('title', 'description') as $key) {
-          $$key = $test['#'. $key];
-          unset($test['#'. $key]);
-        }
-        $test['#name'] = $test_name;
-        $themed_test = drupal_render($test);
-        $row = array();
-        $row[] = $themed_test;
-        $row[] = theme('indentation', 1) .'<label for="edit-'. $test_name .'">'. $title .'</label>';
-        $row[] = '<div class="description">'. $description .'</div>';
-        $rows[] = array('data' => $row, 'style' => 'display: none;', 'class' => $test_class .'-test');
+    }
+    else {
+      $row[] = '';
+    }
+    $rows[] = array('data' => $row, 'class' => 'simpletest-group');
+    $current_js = array('testClass' => $test_class .'-test', 'testNames' => array(), 'imageDirection' => 0, 'clickActive' => FALSE);
+    
+    // Go through each test in the group and create table rows setting them to invisible:
+    foreach (element_children($element) as $test_name) {
+      $current_js['testNames'][] = 'edit-'. $test_name;
+      $test = $element[$test_name];
+      foreach (array('title', 'description') as $key) {
+        $$key = $test['#'. $key];
+        unset($test['#'. $key]);
       }
-      $js['simpletest-test-group-'. $test_class] = $current_js;
-      unset($form[$gid]); // Remove test group from form.
+      $test['#name'] = $test_name;
+      $themed_test = drupal_render($test);
+      $row = array();
+      $row[] = $themed_test;
+      $row[] = theme('indentation', 1) .'<label for="edit-'. $test_name .'">'. $title .'</label>';
+      $row[] = '<div class="description">'. $description .'</div>';
+      $rows[] = array('data' => $row, 'style' => 'display: none;', 'class' => $test_class .'-test');
     }
+    $js['simpletest-test-group-'. $test_class] = $current_js;
   }
+  unset($form['tests']);
   drupal_add_js(array('simpleTest' => $js), 'setting');
 
   // Output test groups:
@@ -245,44 +208,83 @@ function theme_simpletest_overview_form(
   return $output;
 }
 
-/**
- * Compare two test instance objects for use in sorting.
- */
-function simpletest_compare_instances(&$a, &$b) {
-  if (substr_compare($a->_label, $b->_label, 0) > 0) {
-    return 1;
-  }
-  return -1;
-}
-
-/**
- * Run selected tests.
- */
-function simpletest_run_selected_tests($form, &$form_state) {
+function simpletest_test_form_submit($form, &$form_state) {
+  // Include tests.
+  $tests = simpletest_get_all_tests();
   $form_state['redirect'] = FALSE;
-  $output = '';
   switch ($form_state['values']['running_options']) {
+    /*
     case 'all_tests':
       $output = simpletest_run_tests();
       break;
+    */
     case 'selected_tests':
-      $tests_list = array();
+      $test_list = array();
+      $test_run = FALSE;
       foreach ($form_state['values'] as $item => $value) {
-        if ($value === 1 && strpos($item, 'selectall') === FALSE) {
-           $tests_list[] = $item;
+        if ($value === 1) {
+          // We've found a test to run – run it!
+          $test = new $item;
+          simpletest_set_current_test($test);
+          $info = $test->getInfo();
+          $form_state['storage']['tests_run'][$info['group']][$item] = $test->run();
+          $test_run = TRUE;
         }
       }
-      if (count($tests_list) > 0 ) {
-        $output = simpletest_run_tests($tests_list);
-        break;
+      if ($test_run) {
+        return TRUE;
       }
       // Fall through
     default:
       drupal_set_message(t('No test has been selected.'), 'error');
   }
+}
+
+function simpletest_get_all_tests() {
+  static $classes;
+  if (!isset($classes)) {
+    $files = array();
+    foreach (array_keys(module_rebuild_cache()) as $module) {
+      $module_path = drupal_get_path('module', $module);
+      $test = $module_path . "/$module.test";
+      if (file_exists($test)) {
+        $files[] = $test;
+      }
+
+      $tests_directory = $module_path . '/tests';
+      if (is_dir($tests_directory)) {
+        foreach (file_scan_directory($tests_directory, '\.test$') as $file) {
+          $files[] = $file->filename;
+        }
+      }
+    }
+
+    $existing_classes = get_declared_classes();
+    foreach ($files as $file) {
+      include_once($file);
+    }
+    $classes = array_values(array_diff(get_declared_classes(), $existing_classes));
+    foreach ($classes as $key => $class) {
+      if (!method_exists($class, 'getInfo')) {
+        unset($classes[$key]);
+      }
+    }
+  }
+  if (count($classes) == 0) {
+    drupal_set_message('No test cases found.', 'error');
+    return FALSE;
+  }
+  return $classes;
+}
 
-  simpletest_running_output($output);
-  return FALSE;
+function simpletest_categorize_tests($tests) {
+  $groups = array();
+  foreach ($tests as $test) {
+    $instance = new $test;
+    $info = $instance->getInfo();
+    $groups[$info['group']][] = $instance;
+  }
+  return $groups;
 }
 
 /**
@@ -312,6 +314,41 @@ function simpletest_clean_database() {
   }
 }
 
+function simpletest_get_current_test() {
+  return simpletest_set_current_test();
+}
+
+function simpletest_set_current_test($test = NULL) {
+  static $current_test;
+  if (isset($test)) {
+    $current_test = $test;
+  }
+  return $current_test;
+}
+
+function simpletest_error_handler($severity, $message, $file = NULL, $line = NULL) {
+  $severity = $severity & error_reporting();
+  if ($severity) {
+    $error_map = array(
+      E_STRICT => 'Run-time notice',
+      E_WARNING => 'Warning',
+      E_NOTICE => 'Notice',
+      E_CORE_ERROR => 'Core error',
+      E_CORE_WARNING => 'Core warning',
+      E_USER_ERROR => 'User error',
+      E_USER_WARNING => 'User warning',
+      E_USER_NOTICE => 'User notice',
+      E_RECOVERABLE_ERROR => 'Recoverable error',
+    );
+    simpletest_get_current_test()->error($message, $error_map[$severity], array(
+      'function' => '',
+      'line' => $line,
+      'file' => $file,
+    ));
+  }
+  return TRUE;
+}
+
 /**
  * Find all tables that are like the specified base table name.
  *
@@ -379,65 +416,6 @@ function simpletest_clean_temporary_dire
   rmdir($path);
 }
 
-/**
- * Actually runs tests
- * @param array $test_list list of tests to run or DEFAULT NULL run all tests
- * @param boolean $html_reporter TRUE if you want results in simple html, FALSE for full drupal page
- */
-function simpletest_run_tests($test_list = NULL, $reporter = 'drupal') {
-  static $test_running;
-  if (!$test_running) {
-    $test_running = TRUE;
-    $test = simpletest_get_total_test($test_list);
-    switch ($reporter) {
-      case 'text':
-        $reporter = &new TextReporter();
-        break;
-      case 'xml':
-        $reporter = &new XMLReporter();
-        break;
-      case 'html':
-        $reporter = &new HtmlReporter();
-        break;
-      case 'drupal':
-        $reporter = &new DrupalReporter();
-        break;
-    }
-
-    cache_clear_all();
-    $results = $test->run($reporter);
-    $test_running = FALSE;
-
-    switch (get_class($reporter)) {
-      case 'TextReporter':
-      case 'XMLReporter':
-      case 'HtmlReporter':
-        return $results;
-      case 'DrupalReporter':
-        return $reporter->getOutput();
-    }
-  }
-}
-
-/**
- * This function makes sure no unnecessary copies of the DrupalTests object are instantiated
- * @param  array $classes list of all classes the test should concern or
- *                        DEFAULT NULL
- * @return DrupalTests object
- */
-function &simpletest_get_total_test($classes = NULL) {
-  static $total_test;
-  if (!$total_test) {
-    simpletest_load();
-    $total_test = &new DrupalTests();
-  }
-  if (!is_null($classes)) {
-    $dut = new DrupalTests($classes);
-    return $dut;
-  }
-  return $total_test;
-}
-
 function simpletest_settings() {
   $form = array();
 
@@ -474,5 +452,4 @@ function simpletest_settings() {
   );
 
   return system_settings_form($form);
-
 }
Index: modules/simpletest/simpletest.php
===================================================================
RCS file: modules/simpletest/simpletest.php
diff -N modules/simpletest/simpletest.php
--- modules/simpletest/simpletest.php	20 Apr 2008 18:23:29 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,369 +0,0 @@
-<?php
-// $Id: simpletest.php,v 1.1 2008/04/20 18:23:29 dries Exp $
-
-require_once dirname(__FILE__) .'/test_case.php';
-require_once dirname(__FILE__) .'/unit_tester.php';
-require_once dirname(__FILE__) .'/expectation.php';
-require_once dirname(__FILE__) .'/invoker.php';
-require_once dirname(__FILE__) .'/scorer.php';
-require_once dirname(__FILE__) .'/reporter.php';
-require_once dirname(__FILE__) .'/default_reporter.php';
-require_once dirname(__FILE__) .'/dumper.php';
-require_once dirname(__FILE__) .'/errors.php';
-require_once dirname(__FILE__) .'/exceptions.php';
-require_once dirname(__FILE__) .'/xml.php';
-
-/**
- * Registry and test context. Includes a few
- * global options that I'm slowly getting rid of.
- */
-class SimpleTest {
-  /**
-   *  Sets the name of a test case to ignore, usually
-   *  because the class is an abstract case that should
-   *  not be run. Once PHP4 is dropped this will disappear
-   *  as a public method and "abstract" will rule.
-   *  @param string $class    Add a class to ignore.
-   *  @static
-   *  @access public
-   */
-  function ignore($class) {
-    $registry = &SimpleTest::_getRegistry();
-    $registry['IgnoreList'][strtolower($class)] = true;
-  }
-
-  /**
-   *  Scans the now complete ignore list, and adds
-   *  all parent classes to the list. If a class
-   *  is not a runnable test case, then it's parents
-   *  wouldn't be either. This is syntactic sugar
-   *  to cut down on ommissions of ignore()'s or
-   *  missing abstract declarations. This cannot
-   *  be done whilst loading classes wiithout forcing
-   *  a particular order on the class declarations and
-   *  the ignore() calls. It's just nice to have the ignore()
-   *  calls at the top of the file before the actual declarations.
-   *  @param array $classes   Class names of interest.
-   *  @static
-   *  @access public
-   */
-  function ignoreParentsIfIgnored($classes) {
-    $registry = &SimpleTest::_getRegistry();
-    foreach ($classes as $class) {
-      if (SimpleTest::isIgnored($class)) {
-        $reflection = new ReflectionClass($class);
-        if ($parent = $reflection->getParentClass()) {
-          SimpleTest::ignore($parent->getName());
-        }
-      }
-    }
-  }
-
-  /**
-   *   Puts the object to the global pool of 'preferred' objects
-   *   which can be retrieved with SimpleTest :: preferred() method.
-   *   Instances of the same class are overwritten.
-   *   @param object $object    Preferred object
-   *   @static
-   *   @access public
-   *   @see preferred()
-   */
-  function prefer(&$object) {
-    $registry = &SimpleTest::_getRegistry();
-    $registry['Preferred'][] = &$object;
-  }
-
-  /**
-   *   Retrieves 'preferred' objects from global pool. Class filter
-   *   can be applied in order to retrieve the object of the specific
-   *   class
-   *   @param array|string $classes     Allowed classes or interfaces.
-   *   @static
-   *   @access public
-   *   @return array|object|null
-   *   @see prefer()
-   */
-  function &preferred($classes) {
-    if (! is_array($classes)) {
-      $classes = array($classes);
-    }
-    $registry = &SimpleTest::_getRegistry();
-    for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) {
-      foreach ($classes as $class) {
-        if (is_a($registry['Preferred'][$i], $class)) {
-          return $registry['Preferred'][$i];
-        }
-      }
-    }
-    return null;
-  }
-
-  /**
-   *  Test to see if a test case is in the ignore
-   *  list. Quite obviously the ignore list should
-   *  be a separate object and will be one day.
-   *  This method is internal to SimpleTest. Don't
-   *  use it.
-   *  @param string $class    Class name to test.
-   *  @return boolean       True if should not be run.
-   *  @access public
-   *  @static
-   */
-  function isIgnored($class) {
-    $registry = &SimpleTest::_getRegistry();
-    return isset($registry['IgnoreList'][strtolower($class)]);
-  }
-
-  /**
-   *  Sets proxy to use on all requests for when
-   *  testing from behind a firewall. Set host
-   *  to false to disable. This will take effect
-   *  if there are no other proxy settings.
-   *  @param string $proxy   Proxy host as URL.
-   *  @param string $username  Proxy username for authentication.
-   *  @param string $password  Proxy password for authentication.
-   *  @access public
-   */
-  function useProxy($proxy, $username = false, $password = false) {
-    $registry = &SimpleTest::_getRegistry();
-    $registry['DefaultProxy'] = $proxy;
-    $registry['DefaultProxyUsername'] = $username;
-    $registry['DefaultProxyPassword'] = $password;
-  }
-
-  /**
-   *  Accessor for default proxy host.
-   *  @return string     Proxy URL.
-   *  @access public
-   */
-  function getDefaultProxy() {
-    $registry = &SimpleTest::_getRegistry();
-    return $registry['DefaultProxy'];
-  }
-
-  /**
-   *  Accessor for default proxy username.
-   *  @return string  Proxy username for authentication.
-   *  @access public
-   */
-  function getDefaultProxyUsername() {
-    $registry = &SimpleTest::_getRegistry();
-    return $registry['DefaultProxyUsername'];
-  }
-
-  /**
-   *  Accessor for default proxy password.
-   *  @return string  Proxy password for authentication.
-   *  @access public
-   */
-  function getDefaultProxyPassword() {
-    $registry = &SimpleTest::_getRegistry();
-    return $registry['DefaultProxyPassword'];
-  }
-
-  /**
-   *  Accessor for global registry of options.
-   *  @return hash       All stored values.
-   *  @access private
-   *  @static
-   */
-  function &_getRegistry() {
-    static $registry = false;
-    if (! $registry) {
-      $registry = SimpleTest::_getDefaults();
-    }
-    return $registry;
-  }
-
-  /**
-   *  Accessor for the context of the current
-   *  test run.
-   *  @return SimpleTestContext  Current test run.
-   *  @access public
-   *  @static
-   */
-  function &getContext() {
-    static $context = false;
-    if (! $context) {
-      $context = new SimpleTestContext();
-    }
-    return $context;
-  }
-
-  /**
-   *  Constant default values.
-   *  @return hash     All registry defaults.
-   *  @access private
-   *  @static
-   */
-  function _getDefaults() {
-    return array(
-        'StubBaseClass' => 'SimpleStub',
-        'MockBaseClass' => 'SimpleMock',
-        'IgnoreList' => array(),
-        'DefaultProxy' => false,
-        'DefaultProxyUsername' => false,
-        'DefaultProxyPassword' => false,
-        'Preferred' => array(new HtmlReporter(), new TextReporter(), new XmlReporter()));
-  }
-}
-
-/**
- *  Container for all components for a specific
- *  test run. Makes things like error queues
- *  available to PHP event handlers, and also
- *  gets around some nasty reference issues in
- *  the mocks.
- *  @package  SimpleTest
- */
-class SimpleTestContext {
-  var $_test;
-  var $_reporter;
-  var $_resources;
-
-  /**
-   *  Clears down the current context.
-   *  @access public
-   */
-  function clear() {
-    $this->_resources = array();
-  }
-
-  /**
-   *  Sets the current test case instance. This
-   *  global instance can be used by the mock objects
-   *  to send message to the test cases.
-   *  @param SimpleTestCase $test    Test case to register.
-   *  @access public
-   */
-  function setTest(&$test) {
-    $this->clear();
-    $this->_test = &$test;
-  }
-
-  /**
-   *  Accessor for currently running test case.
-   *  @return SimpleTestCase  Current test.
-   *  @access public
-   */
-  function &getTest() {
-    return $this->_test;
-  }
-
-  /**
-   *  Sets the current reporter. This
-   *  global instance can be used by the mock objects
-   *  to send messages.
-   *  @param SimpleReporter $reporter   Reporter to register.
-   *  @access public
-   */
-  function setReporter(&$reporter) {
-    $this->clear();
-    $this->_reporter = &$reporter;
-  }
-
-  /**
-   *  Accessor for current reporter.
-   *  @return SimpleReporter  Current reporter.
-   *  @access public
-   */
-  function &getReporter() {
-    return $this->_reporter;
-  }
-
-  /**
-   *  Accessor for the Singleton resource.
-   *  @return object     Global resource.
-   *  @access public
-   *  @static
-   */
-  function &get($resource) {
-    if (! isset($this->_resources[$resource])) {
-      $this->_resources[$resource] = &new $resource();
-    }
-    return $this->_resources[$resource];
-  }
-}
-
-/**
- *  Interrogates the stack trace to recover the
- *  failure point.
- */
-class SimpleStackTrace {
-  var $_prefixes;
-
-  /**
-   *  Stashes the list of target prefixes.
-   *  @param array $prefixes    List of method prefixes
-   *                to search for.
-   */
-  function SimpleStackTrace($prefixes) {
-    $this->_prefixes = $prefixes;
-  }
-
-  /**
-   *  Extracts the last method name that was not within
-   *  Simpletest itself. Captures a stack trace if none given.
-   *  @param array $stack    List of stack frames.
-   *  @return string       Snippet of test report with line
-   *               number and file.
-   *  @access public
-   */
-  function traceMethod($stack = false) {
-    $stack = $stack ? $stack : $this->_captureTrace();
-    foreach ($stack as $frame) {
-      if ($this->_frameLiesWithinSimpleTestFolder($frame)) {
-        continue;
-      }
-      if ($this->_frameMatchesPrefix($frame)) {
-        return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']';
-      }
-    }
-    return '';
-  }
-
-  /**
-   *  Test to see if error is generated by SimpleTest itself.
-   *  @param array $frame   PHP stack frame.
-   *  @return boolean     True if a SimpleTest file.
-   *  @access private
-   */
-  function _frameLiesWithinSimpleTestFolder($frame) {
-    if (isset($frame['file'])) {
-      $path = dirname(__FILE__);
-      if (strpos($frame['file'], $path) === 0) {
-        if (dirname($frame['file']) == $path) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  /**
-   *  Tries to determine if the method call is an assert, etc.
-   *  @param array $frame   PHP stack frame.
-   *  @return boolean     True if matches a target.
-   *  @access private
-   */
-  function _frameMatchesPrefix($frame) {
-    foreach ($this->_prefixes as $prefix) {
-      if (strncmp($frame['function'], $prefix, strlen($prefix)) == 0) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   *  Grabs a current stack trace.
-   *  @return array    Fulle trace.
-   *  @access private
-   */
-  function _captureTrace() {
-    if (function_exists('debug_backtrace')) {
-      return array_reverse(debug_backtrace());
-    }
-    return array();
-  }
-}
Index: modules/simpletest/test_case.php
===================================================================
RCS file: modules/simpletest/test_case.php
diff -N modules/simpletest/test_case.php
--- modules/simpletest/test_case.php	23 Apr 2008 20:01:53 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,615 +0,0 @@
-<?php
-// $Id: test_case.php,v 1.2 2008/04/23 20:01:53 dries Exp $
-
-/**
- *    Basic test case. This is the smallest unit of a test
- *    suite. It searches for
- *    all methods that start with the the string "test" and
- *    runs them. Working test cases extend this class.
- */
-class SimpleTestCase {
-  var $_label = false;
-  var $_reporter;
-  var $_observers;
-  var $_should_skip = false;
-
-  /**
-   *    Sets up the test with no display.
-   *    @param string $label    If no test name is given then
-   *                            the class name is used.
-   *    @access public
-   */
-  function SimpleTestCase($label = false) {
-    if ($label) {
-      $this->_label = $label;
-    }
-  }
-
-  /**
-   *    Accessor for the test name for subclasses.
-   *    @return string           Name of the test.
-   *    @access public
-   */
-  function getLabel() {
-    return $this->_label ? $this->_label : get_class($this);
-  }
-
-  /**
-   *    This is a placeholder for skipping tests. In this
-   *    method you place skipIf() and skipUnless() calls to
-   *    set the skipping state.
-   *    @access public
-   */
-  function skip() {}
-
-  /**
-   *    Will issue a message to the reporter and tell the test
-   *    case to skip if the incoming flag is true.
-   *    @param string $should_skip    Condition causing the tests to be skipped.
-   *    @param string $message      Text of skip condition.
-   *    @access public
-   */
-  function skipIf($should_skip, $message = '%s') {
-    if ($should_skip && !$this->_should_skip) {
-      $this->_should_skip = true;
-      $message = sprintf($message, 'Skipping ['. get_class($this) .']');
-      $this->_reporter->paintSkip($message . $this->getAssertionLine());
-    }
-  }
-
-  /**
-   *    Will issue a message to the reporter and tell the test
-   *    case to skip if the incoming flag is false.
-   *    @param string $shouldnt_skip  Condition causing the tests to be run.
-   *    @param string $message      Text of skip condition.
-   *    @access public
-   */
-  function skipUnless($shouldnt_skip, $message = false) {
-    $this->skipIf(!$shouldnt_skip, $message);
-  }
-
-  /**
-   *    Used to invoke the single tests.
-   *    @return SimpleInvoker        Individual test runner.
-   *    @access public
-   */
-  function & createInvoker() {
-    $invoker = &new SimpleErrorTrappingInvoker(new SimpleInvoker($this));
-    if (version_compare(phpversion(), '5') >= 0) {
-      $invoker = &new SimpleExceptionTrappingInvoker($invoker);
-    }
-    return $invoker;
-  }
-
-  /**
-   *    Uses reflection to run every method within itself
-   *    starting with the string "test" unless a method
-   *    is specified.
-   *    @param SimpleReporter $reporter    Current test reporter.
-   *    @return boolean                    True if all tests passed.
-   *    @access public
-   */
-  function run(&$reporter) {
-    $context = &SimpleTest::getContext();
-    $context->setTest($this);
-    $context->setReporter($reporter);
-    $this->_reporter = &$reporter;
-    $started = false;
-    foreach ($this->getTests() as $method) {
-      if ($reporter->shouldInvoke($this->getLabel(), $method)) {
-        $this->skip();
-        if ($this->_should_skip) {
-          break;
-        }
-        if (!$started) {
-          $reporter->paintCaseStart($this->getLabel());
-          $started = true;
-        }
-        $invoker = &$this->_reporter->createInvoker($this->createInvoker());
-        $invoker->before($method);
-        $invoker->invoke($method);
-        $invoker->after($method);
-      }
-    }
-    if ($started) {
-      $reporter->paintCaseEnd($this->getLabel());
-    }
-    unset($this->_reporter);
-    return $reporter->getStatus();
-  }
-
-  /**
-   *    Gets a list of test names. Normally that will
-   *    be all internal methods that start with the
-   *    name "test". This method should be overridden
-   *    if you want a different rule.
-   *    @return array        List of test names.
-   *    @access public
-   */
-  function getTests() {
-    $methods = array();
-    foreach (get_class_methods(get_class($this)) as $method) {
-      if ($this->_isTest($method)) {
-        $methods[] = $method;
-      }
-    }
-    return $methods;
-  }
-
-  /**
-   *    Tests to see if the method is a test that should
-   *    be run. Currently any method that starts with 'test'
-   *    is a candidate unless it is the constructor.
-   *    @param string $method        Method name to try.
-   *    @return boolean              True if test method.
-   *    @access protected
-   */
-  function _isTest($method) {
-    if (strtolower(substr($method, 0, 4)) == 'test') {
-      return !is_a($this, strtolower($method));
-    }
-    return false;
-  }
-
-  /**
-   *    Announces the start of the test.
-   *    @param string $method    Test method just started.
-   *    @access public
-   */
-  function before($method) {
-    $this->_reporter->paintMethodStart($method);
-    $this->_observers = array();
-  }
-
-  /**
-   *    Sets up unit test wide variables at the start
-   *    of each test method. To be overridden in
-   *    actual user test cases.
-   *    @access public
-   */
-  function setUp() {}
-
-  /**
-   *    Clears the data set in the setUp() method call.
-   *    To be overridden by the user in actual user test cases.
-   *    @access public
-   */
-  function tearDown() {}
-
-  /**
-   *    Announces the end of the test. Includes private clean up.
-   *    @param string $method    Test method just finished.
-   *    @access public
-   */
-  function after($method) {
-    for ($i = 0; $i < count($this->_observers); $i++) {
-      $this->_observers[$i]->atTestEnd($method, $this);
-    }
-    $this->_reporter->paintMethodEnd($method);
-  }
-
-  /**
-   *    Sets up an observer for the test end.
-   *    @param object $observer    Must have atTestEnd()
-   *                               method.
-   *    @access public
-   */
-  function tell(&$observer) {
-    $this->_observers[] = &$observer;
-  }
-
-  /**
-   *    @deprecated
-   */
-  function pass($message = 'Pass', $group = 'Other') {
-    if (!isset($this->_reporter)) {
-      trigger_error('Can only make assertions within test methods');
-    }
-    $this->_reporter->paintPass($message . $this->getAssertionLine(), $group);
-    return TRUE;
-  }
-
-  /**
-   *    Sends a fail event with a message.
-   *    @param string $message        Message to send.
-   *    @access public
-   */
-  function fail($message = 'Fail', $group = 'Other') {
-    if (!isset($this->_reporter)) {
-      trigger_error('Can only make assertions within test methods');
-    }
-    $this->_reporter->paintFail($message . $this->getAssertionLine(), $group);
-    return FALSE;
-  }
-
-  /**
-   *    Formats a PHP error and dispatches it to the
-   *    reporter.
-   *    @param integer $severity  PHP error code.
-   *    @param string $message    Text of error.
-   *    @param string $file       File error occoured in.
-   *    @param integer $line      Line number of error.
-   *    @access public
-   */
-  function error($severity, $message, $file, $line) {
-    if (!isset($this->_reporter)) {
-      trigger_error('Can only make assertions within test methods');
-    }
-    $this->_reporter->paintError("Unexpected PHP error [$message] severity [$severity] in [$file line $line]");
-  }
-
-  /**
-   *    Formats an exception and dispatches it to the
-   *    reporter.
-   *    @param Exception $exception    Object thrown.
-   *    @access public
-   */
-  function exception($exception) {
-    $this->_reporter->paintException($exception);
-  }
-
-  /**
-   *    @deprecated
-   */
-  function signal($type, &$payload) {
-    if (!isset($this->_reporter)) {
-      trigger_error('Can only make assertions within test methods');
-    }
-    $this->_reporter->paintSignal($type, $payload);
-  }
-
-  /**
-   *    Runs an expectation directly, for extending the
-   *    tests with new expectation classes.
-   *    @param SimpleExpectation $expectation  Expectation subclass.
-   *    @param mixed $compare               Value to compare.
-   *    @param string $message                 Message to display.
-   *    @return boolean                        True on pass
-   *    @access public
-   */
-  function assert(&$expectation, $compare, $message = '%s', $group = 'Other') {
-    if ($expectation->test($compare)) {
-      return $this->pass(sprintf($message, $expectation->overlayMessage($compare, $this->_reporter->getDumper())), $group);
-    }
-    else {
-      return $this->fail(sprintf($message, $expectation->overlayMessage($compare, $this->_reporter->getDumper())), $group);
-    }
-  }
-
-  /**
-   *    @deprecated
-   */
-  function assertExpectation(&$expectation, $compare, $message = '%s', $group = 'Other') {
-    return $this->assert($expectation, $compare, $message, $group);
-  }
-
-  /**
-   *    Uses a stack trace to find the line of an assertion.
-   *    @return string           Line number of first assert*
-   *                             method embedded in format string.
-   *    @access public
-   */
-  function getAssertionLine() {
-    $trace = new SimpleStackTrace(array('assert', 'expect', 'pass', 'fail', 'skip'));
-    return $trace->traceMethod();
-  }
-
-  /**
-   *    @deprecated
-   */
-  function sendMessage($message) {
-    $this->_reporter->PaintMessage($message);
-  }
-
-  /**
-   *    Accessor for the number of subtests.
-   *    @return integer           Number of test cases.
-   *    @access public
-   *    @static
-   */
-  function getSize() {
-    return 1;
-  }
-}
-
-/**
- *  Helps to extract test cases automatically from a file.
- */
-class SimpleFileLoader {
-
-  /**
-   *    Builds a test suite from a library of test cases.
-   *    The new suite is composed into this one.
-   *    @param string $test_file        File name of library with
-   *                                    test case classes.
-   *    @return TestSuite               The new test suite.
-   *    @access public
-   */
-  function &load($test_file) {
-    $existing_classes = get_declared_classes();
-    include_once ($test_file);
-    $classes = $this->selectRunnableTests(
-      array_diff(get_declared_classes(), $existing_classes));
-    $suite = &$this->createSuiteFromClasses($test_file, $classes);
-    return $suite;
-  }
-
-  /**
-   *    Calculates the incoming test cases. Skips abstract
-   *    and ignored classes.
-   *    @param array $candidates   Candidate classes.
-   *    @return array              New classes which are test
-   *                               cases that shouldn't be ignored.
-   *    @access public
-   */
-  function selectRunnableTests($candidates) {
-    $classes = array();
-    foreach ($candidates as $class) {
-      if (TestSuite::getBaseTestCase($class)) {
-        $reflection = new ReflectionClass($class);
-        if ($reflection->isAbstract()) {
-          SimpleTest::ignore($class);
-        }
-        $classes[] = $class;
-      }
-    }
-    return $classes;
-  }
-
-  /**
-   *    Builds a test suite from a class list.
-   *    @param string $title       Title of new group.
-   *    @param array $classes      Test classes.
-   *    @return TestSuite          Group loaded with the new
-   *                               test cases.
-   *    @access public
-   */
-  function &createSuiteFromClasses($title, $classes) {
-    if (count($classes) == 0) {
-      $suite = &new BadTestSuite($title, "No runnable test cases in [$title]");
-      return $suite;
-    }
-    SimpleTest::ignoreParentsIfIgnored($classes);
-    $suite = &new TestSuite($title);
-    foreach ($classes as $class) {
-      if (!SimpleTest::isIgnored($class)) {
-        $suite->addTestClass($class);
-      }
-    }
-    return $suite;
-  }
-}
-
-/**
- *    This is a composite test class for combining
- *    test cases and other RunnableTest classes into
- *    a group test.
- *    @package    SimpleTest
- *    @subpackage  UnitTester
- */
-class TestSuite {
-  var $_label;
-  var $_test_cases;
-
-  /**
-   *    Sets the name of the test suite.
-   *    @param string $label    Name sent at the start and end
-   *                            of the test.
-   *    @access public
-   */
-  function TestSuite($label = false) {
-    $this->_label = $label;
-    $this->_test_cases = array();
-  }
-
-  /**
-   *    Accessor for the test name for subclasses. If the suite
-   *    wraps a single test case the label defaults to the name of that test.
-   *    @return string           Name of the test.
-   *    @access public
-   */
-  function getLabel() {
-    if (!$this->_label) {
-      return ($this->getSize() == 1) ? get_class($this->_test_cases[0]) : get_class($this);
-    }
-    else {
-      return $this->_label;
-    }
-  }
-
-  /**
-   *    @deprecated
-   */
-  function addTestCase(&$test_case) {
-    $this->_test_cases[] = &$test_case;
-  }
-
-  /**
-   *    @deprecated
-   */
-  function addTestClass($class) {
-    if (TestSuite::getBaseTestCase($class) == 'testsuite') {
-      $this->_test_cases[] = &new $class();
-    }
-    else {
-      $this->_test_cases[] = $class;
-    }
-  }
-
-  /**
-   *    Adds a test into the suite by instance or class. The class will
-   *    be instantiated if it's a test suite.
-   *    @param SimpleTestCase $test_case  Suite or individual test
-   *                                      case implementing the
-   *                                      runnable test interface.
-   *    @access public
-   */
-  function add(&$test_case) {
-    if (!is_string($test_case)) {
-      $this->_test_cases[] = &$test_case;
-    }
-    elseif (TestSuite::getBaseTestCase($class) == 'testsuite') {
-      $this->_test_cases[] = &new $class();
-    }
-    else {
-      $this->_test_cases[] = $class;
-    }
-  }
-
-  /**
-   *    @deprecated
-   */
-  function addTestFile($test_file) {
-    $this->addFile($test_file);
-  }
-
-  /**
-   *    Builds a test suite from a library of test cases.
-   *    The new suite is composed into this one.
-   *    @param string $test_file        File name of library with
-   *                                    test case classes.
-   *    @access public
-   */
-  function addFile($test_file) {
-    $extractor = new SimpleFileLoader();
-    $this->add($extractor->load($test_file));
-  }
-
-  /**
-   *    Delegates to a visiting collector to add test
-   *    files.
-   *    @param string $path                  Path to scan from.
-   *    @param SimpleCollector $collector    Directory scanner.
-   *    @access public
-   */
-  function collect($path, &$collector) {
-    $collector->collect($this, $path);
-  }
-
-  /**
-   *    Invokes run() on all of the held test cases, instantiating
-   *    them if necessary.
-   *    @param SimpleReporter $reporter    Current test reporter.
-   *    @access public
-   */
-  function run(&$reporter) {
-    $reporter->paintGroupStart($this->getLabel(), $this->getSize());
-    for ($i = 0, $count = count($this->_test_cases); $i < $count; $i++) {
-      if (is_string($this->_test_cases[$i])) {
-        $class = $this->_test_cases[$i];
-        $test = &new $class();
-        $test->run($reporter);
-        unset($test);
-      }
-      else {
-        $this->_test_cases[$i]->run($reporter);
-      }
-    }
-    $reporter->paintGroupEnd($this->getLabel());
-    return $reporter->getStatus();
-  }
-
-  /**
-   *    Number of contained test cases.
-   *    @return integer     Total count of cases in the group.
-   *    @access public
-   */
-  function getSize() {
-    $count = 0;
-    foreach ($this->_test_cases as $case) {
-      if (is_string($case)) {
-        $count++;
-      }
-      else {
-        $count += $case->getSize();
-      }
-    }
-    return $count;
-  }
-
-  /**
-   *    Test to see if a class is derived from the
-   *    SimpleTestCase class.
-   *    @param string $class     Class name.
-   *    @access public
-   *    @static
-   */
-  function getBaseTestCase($class) {
-    while ($class = get_parent_class($class)) {
-      $class = strtolower($class);
-      if ($class == 'simpletestcase' || $class == 'testsuite') {
-        return $class;
-      }
-    }
-    return false;
-  }
-}
-
-/**
- *    @package    SimpleTest
- *    @subpackage  UnitTester
- *    @deprecated
- */
-class GroupTest extends TestSuite {}
-
-/**
- *    This is a failing group test for when a test suite hasn't
- *    loaded properly.
- *    @package    SimpleTest
- *    @subpackage  UnitTester
- */
-class BadTestSuite {
-  var $_label;
-  var $_error;
-
-  /**
-   *    Sets the name of the test suite and error message.
-   *    @param string $label    Name sent at the start and end
-   *                            of the test.
-   *    @access public
-   */
-  function BadTestSuite($label, $error) {
-    $this->_label = $label;
-    $this->_error = $error;
-  }
-
-  /**
-   *    Accessor for the test name for subclasses.
-   *    @return string           Name of the test.
-   *    @access public
-   */
-  function getLabel() {
-    return $this->_label;
-  }
-
-  /**
-   *    Sends a single error to the reporter.
-   *    @param SimpleReporter $reporter    Current test reporter.
-   *    @access public
-   */
-  function run(&$reporter) {
-    $reporter->paintGroupStart($this->getLabel(), $this->getSize());
-    $reporter->paintFail('Bad TestSuite ['. $this->getLabel() .
-      '] with error ['. $this->_error .']');
-    $reporter->paintGroupEnd($this->getLabel());
-    return $reporter->getStatus();
-  }
-
-  /**
-   *    Number of contained test cases. Always zero.
-   *    @return integer     Total count of cases in the group.
-   *    @access public
-   */
-  function getSize() {
-    return 0;
-  }
-}
-
-/**
- *    @package    SimpleTest
- *    @subpackage  UnitTester
- *    @deprecated
- */
-class BadGroupTest extends BadTestSuite {}
-
-
Index: modules/simpletest/unit_tester.php
===================================================================
RCS file: modules/simpletest/unit_tester.php
diff -N modules/simpletest/unit_tester.php
--- modules/simpletest/unit_tester.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,178 +0,0 @@
-<?php
-// $Id: unit_tester.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-/**
- * Standard unit test class for day to day testing
- * of PHP code XP style. Adds some useful standard
- * assertions.
- */
-class UnitTestCase extends SimpleTestCase {
-
-  /**
-   *    Creates an empty test case. Should be subclassed
-   *    with test methods for a functional test case.
-   *    @param string $label     Name of test case. Will use
-   *                             the class name if none specified.
-   *    @access public
-   */
-  function UnitTestCase($label = false) {
-    if (!$label) {
-      $label = get_class($this);
-    }
-    $this->SimpleTestCase($label);
-  }
-
-  /**
-   *    Called from within the test methods to register
-   *    passes and failures.
-   *    @param boolean $result    Pass on true.
-   *    @param string $message    Message to display describing
-   *                              the test state.
-   *    @return boolean           True on pass
-   *    @access public
-   */
-  function assertTrue($result, $message = FALSE, $group = 'Other') {
-    return $this->assert(new TrueExpectation(), $result, $message, $group);
-  }
-
-  /**
-   *    Will be true on false and vice versa. False
-   *    is the PHP definition of false, so that null,
-   *    empty strings, zero and an empty array all count
-   *    as false.
-   *    @param boolean $result    Pass on false.
-   *    @param string $message    Message to display.
-   *    @return boolean           True on pass
-   *    @access public
-   */
-  function assertFalse($result, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, 'Expected false, got ['. $dumper->describeValue($result) .']');
-    return $this->assertTrue(!$result, $message, $group);
-  }
-
-  /**
-   *    Will be true if the value is null.
-   *    @param null $value       Supposedly null value.
-   *    @param string $message   Message to display.
-   *    @return boolean                        True on pass
-   *    @access public
-   */
-  function assertNull($value, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, '['. $dumper->describeValue($value) .'] should be null');
-    return $this->assertTrue(!isset($value), $message, $group);
-  }
-
-  /**
-   *    Will be true if the value is set.
-   *    @param mixed $value           Supposedly set value.
-   *    @param string $message        Message to display.
-   *    @return boolean               True on pass.
-   *    @access public
-   */
-  function assertNotNull($value, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, '['. $dumper->describeValue($value) .'] should not be null');
-    return $this->assertTrue(isset($value), $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the two parameters have
-   *    the same value only. Otherwise a fail.
-   *    @param mixed $first          Value to compare.
-   *    @param mixed $second         Value to compare.
-   *    @param string $message       Message to display.
-   *    @return boolean              True on pass
-   *    @access public
-   */
-  function assertEqual($first, $second, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', got ['. $dumper->describeValue($second) .']');
-    $this->assertTrue($first == $second, $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the two parameters have
-   *    a different value. Otherwise a fail.
-   *    @param mixed $first           Value to compare.
-   *    @param mixed $second          Value to compare.
-   *    @param string $message        Message to display.
-   *    @return boolean               True on pass
-   *    @access public
-   */
-  function assertNotEqual($first, $second, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', not equal to '. $dumper->describeValue($second));
-    $this->assertTrue($first != $second, $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the two parameters have
-   *    the same value and same type. Otherwise a fail.
-   *    @param mixed $first           Value to compare.
-   *    @param mixed $second          Value to compare.
-   *    @param string $message        Message to display.
-   *    @return boolean               True on pass
-   *    @access public
-   */
-  function assertIdentical($first, $second, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', got ['. $dumper->describeValue($second) .']');
-    $this->assertTrue($first === $second, $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the two parameters have
-   *    the different value or different type.
-   *    @param mixed $first           Value to compare.
-   *    @param mixed $second          Value to compare.
-   *    @param string $message        Message to display.
-   *    @return boolean               True on pass
-   *    @access public
-   */
-  function assertNotIdentical($first, $second, $message = '%s', $group = 'Other') {
-    $dumper = &new SimpleDumper();
-    $message = sprintf($message, 'Expected '. $dumper->describeValue($first) .', not identical to '. $dumper->describeValue($second));
-    $this->assertTrue($first !== $second, $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the Perl regex pattern
-   *    is found in the subject. Fail otherwise.
-   *    @param string $pattern    Perl regex to look for including
-   *                              the regex delimiters.
-   *    @param string $subject    String to search in.
-   *    @param string $message    Message to display.
-   *    @return boolean           True on pass
-   *    @access public
-   */
-  function assertPattern($pattern, $subject, $message = '%s', $group = 'Other') {
-    $dumper  = &new SimpleDumper();
-    $replace = 'Pattern '. $pattern .' detected in ['. $dumper->describeValue($subject) .']';
-    $found   = preg_match($pattern, $subject, $matches);
-    if ($found) {
-      $position = strpos($subject, $matches[0]);
-      $replace .= ' in region ['. $dumper->clipString($subject, 100, $position) .']';
-    }
-    $message = sprintf($message, $replace);
-    $this->assertTrue($found, $message, $group);
-  }
-
-  /**
-   *    Will trigger a pass if the perl regex pattern
-   *    is not present in subject. Fail if found.
-   *    @param string $pattern    Perl regex to look for including
-   *                              the regex delimiters.
-   *    @param string $subject    String to search in.
-   *    @param string $message    Message to display.
-   *    @return boolean           True on pass
-   *    @access public
-   */
-  function assertNoPattern($pattern, $subject, $message = '%s', $group = 'Other') {
-    $dumper  = &new SimpleDumper();
-    $found   = preg_match($pattern, $subject);
-    $message = sprintf($message, 'Pattern '. $pattern .' not detected in ['. $dumper->describeValue($subject) .']');
-    $this->assertFalse($found, $message, $group = 'Other');
-  }
-}
\ No newline at end of file
Index: modules/simpletest/xml.php
===================================================================
RCS file: modules/simpletest/xml.php
diff -N modules/simpletest/xml.php
--- modules/simpletest/xml.php	20 Apr 2008 18:34:43 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,641 +0,0 @@
-<?php
-// $Id: xml.php,v 1.1 2008/04/20 18:34:43 dries Exp $
-
-// ---------------------------------------
-//      This file will be removed
-// ---------------------------------------
-
-
-/**
- *    Creates the XML needed for remote communication
- *    by SimpleTest.
- *    @package SimpleTest
- *    @subpackage UnitTester
- */
-class XmlReporter extends SimpleReporter {
-    var $_indent;
-    var $_namespace;
-
-    /**
-     *    Sets up indentation and namespace.
-     *    @param string $namespace        Namespace to add to each tag.
-     *    @param string $indent           Indenting to add on each nesting.
-     *    @access public
-     */
-    function XmlReporter($namespace = false, $indent = '  ') {
-        $this->SimpleReporter();
-        $this->_namespace = ($namespace ? $namespace . ':' : '');
-        $this->_indent = $indent;
-    }
-
-    /**
-     *    Calculates the pretty printing indent level
-     *    from the current level of nesting.
-     *    @param integer $offset  Extra indenting level.
-     *    @return string          Leading space.
-     *    @access protected
-     */
-    function _getIndent($offset = 0) {
-        return str_repeat(
-                $this->_indent,
-                count($this->getTestList()) + $offset);
-    }
-
-    /**
-     *    Converts character string to parsed XML
-     *    entities string.
-     *    @param string text        Unparsed character data.
-     *    @return string            Parsed character data.
-     *    @access public
-     */
-    function toParsedXml($text) {
-        return str_replace(
-                array('&', '<', '>', '"', '\''),
-                array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
-                $text);
-    }
-
-    /**
-     *    Paints the start of a group test.
-     *    @param string $test_name   Name of test that is starting.
-     *    @param integer $size       Number of test cases starting.
-     *    @access public
-     */
-    function paintGroupStart($test_name, $size) {
-        parent::paintGroupStart($test_name, $size);
-        print $this->_getIndent();
-        print "<" . $this->_namespace . "group size=\"$size\">\n";
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "name>" .
-                $this->toParsedXml($test_name) .
-                "</" . $this->_namespace . "name>\n";
-    }
-
-    /**
-     *    Paints the end of a group test.
-     *    @param string $test_name   Name of test that is ending.
-     *    @access public
-     */
-    function paintGroupEnd($test_name) {
-        print $this->_getIndent();
-        print "</" . $this->_namespace . "group>\n";
-        parent::paintGroupEnd($test_name);
-    }
-
-    /**
-     *    Paints the start of a test case.
-     *    @param string $test_name   Name of test that is starting.
-     *    @access public
-     */
-    function paintCaseStart($test_name) {
-        parent::paintCaseStart($test_name);
-        print $this->_getIndent();
-        print "<" . $this->_namespace . "case>\n";
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "name>" .
-                $this->toParsedXml($test_name) .
-                "</" . $this->_namespace . "name>\n";
-    }
-
-    /**
-     *    Paints the end of a test case.
-     *    @param string $test_name   Name of test that is ending.
-     *    @access public
-     */
-    function paintCaseEnd($test_name) {
-        print $this->_getIndent();
-        print "</" . $this->_namespace . "case>\n";
-        parent::paintCaseEnd($test_name);
-    }
-
-    /**
-     *    Paints the start of a test method.
-     *    @param string $test_name   Name of test that is starting.
-     *    @access public
-     */
-    function paintMethodStart($test_name) {
-        parent::paintMethodStart($test_name);
-        print $this->_getIndent();
-        print "<" . $this->_namespace . "test>\n";
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "name>" .
-                $this->toParsedXml($test_name) .
-                "</" . $this->_namespace . "name>\n";
-    }
-
-    /**
-     *    Paints the end of a test method.
-     *    @param string $test_name   Name of test that is ending.
-     *    @param integer $progress   Number of test cases ending.
-     *    @access public
-     */
-    function paintMethodEnd($test_name) {
-        print $this->_getIndent();
-        print "</" . $this->_namespace . "test>\n";
-        parent::paintMethodEnd($test_name);
-    }
-
-    /**
- *    Paints pass as XML.
-     *    @param string $message        Message to encode.
-     *    @access public
-     */
-    function paintPass($message) {
-        parent::paintPass($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "pass>";
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "pass>\n";
-    }
-
-    /**
- *    Paints failure as XML.
-     *    @param string $message        Message to encode.
-     *    @access public
-     */
-    function paintFail($message) {
-        parent::paintFail($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "fail>";
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "fail>\n";
-    }
-
-    /**
- *    Paints error as XML.
-     *    @param string $message        Message to encode.
-     *    @access public
-     */
-    function paintError($message) {
-        parent::paintError($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "exception>";
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "exception>\n";
-    }
-
-    /**
- *    Paints exception as XML.
-     *    @param Exception $exception    Exception to encode.
-     *    @access public
-     */
-    function paintException($exception) {
-        parent::paintException($exception);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "exception>";
-        $message = 'Unexpected exception of type [' . get_class($exception) .
-                '] with message ['. $exception->getMessage() .
-                '] in ['. $exception->getFile() .
-                ' line ' . $exception->getLine() . ']';
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "exception>\n";
-    }
-
-    /**
-     *    Paints the skipping message and tag.
-     *    @param string $message        Text to display in skip tag.
-     *    @access public
-     */
-    function paintSkip($message) {
-        parent::paintSkip($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "skip>";
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "skip>\n";
-    }
-
-    /**
-     *    Paints a simple supplementary message.
-     *    @param string $message        Text to display.
-     *    @access public
-     */
-    function paintMessage($message) {
-        parent::paintMessage($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "message>";
-        print $this->toParsedXml($message);
-        print "</" . $this->_namespace . "message>\n";
-    }
-
-    /**
-     *    Paints a formatted ASCII message such as a
-     *    variable dump.
-     *    @param string $message        Text to display.
-     *    @access public
-     */
-    function paintFormattedMessage($message) {
-        parent::paintFormattedMessage($message);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "formatted>";
-        print "<![CDATA[$message]]>";
-        print "</" . $this->_namespace . "formatted>\n";
-    }
-
-    /**
-     *    Serialises the event object.
-     *    @param string $type        Event type as text.
-     *    @param mixed $payload      Message or object.
-     *    @access public
-     */
-    function paintSignal($type, &$payload) {
-        parent::paintSignal($type, $payload);
-        print $this->_getIndent(1);
-        print "<" . $this->_namespace . "signal type=\"$type\">";
-        print "<![CDATA[" . serialize($payload) . "]]>";
-        print "</" . $this->_namespace . "signal>\n";
-    }
-
-    /**
-     *    Paints the test document header.
-     *    @param string $test_name     First test top level
-     *                                 to start.
-     *    @access public
-     *    @abstract
-     */
-    function paintHeader($test_name) {
-        if (! SimpleReporter::inCli()) {
-            header('Content-type: text/xml');
-        }
-        print "<?xml version=\"1.0\"";
-        if ($this->_namespace) {
-            print " xmlns:" . $this->_namespace .
-                    "=\"www.lastcraft.com/SimpleTest/Beta3/Report\"";
-        }
-        print "?>\n";
-        print "<" . $this->_namespace . "run>\n";
-    }
-
-    /**
-     *    Paints the test document footer.
-     *    @param string $test_name        The top level test.
-     *    @access public
-     *    @abstract
-     */
-    function paintFooter($test_name) {
-        print "</" . $this->_namespace . "run>\n";
-    }
-}
-
-/**
- *    Accumulator for incoming tag. Holds the
- *    incoming test structure information for
- *    later dispatch to the reporter.
-    @package SimpleTest
-    @subpackage UnitTester
- */
-class NestingXmlTag {
-    var $_name;
-    var $_attributes;
-
-    /**
-     *    Sets the basic test information except
-     *    the name.
-     *    @param hash $attributes   Name value pairs.
-     *    @access public
-     */
-    function NestingXmlTag($attributes) {
-        $this->_name = false;
-        $this->_attributes = $attributes;
-    }
-
-    /**
-     *    Sets the test case/method name.
-     *    @param string $name        Name of test.
-     *    @access public
-     */
-    function setName($name) {
-        $this->_name = $name;
-    }
-
-    /**
-     *    Accessor for name.
-     *    @return string        Name of test.
-     *    @access public
-     */
-    function getName() {
-        return $this->_name;
-    }
-
-    /**
-     *    Accessor for attributes.
-     *    @return hash        All attributes.
-     *    @access protected
-     */
-    function _getAttributes() {
-        return $this->_attributes;
-    }
-}
-
-/**
- *    Accumulator for incoming method tag. Holds the
- *    incoming test structure information for
- *    later dispatch to the reporter.
-    @package SimpleTest
-    @subpackage UnitTester
- */
-class NestingMethodTag extends NestingXmlTag {
-
-    /**
-     *    Sets the basic test information except
-     *    the name.
-     *    @param hash $attributes   Name value pairs.
-     *    @access public
-     */
-    function NestingMethodTag($attributes) {
-        $this->NestingXmlTag($attributes);
-    }
-
-    /**
-     *    Signals the appropriate start event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintStart(&$listener) {
-        $listener->paintMethodStart($this->getName());
-    }
-
-    /**
-     *    Signals the appropriate end event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintEnd(&$listener) {
-        $listener->paintMethodEnd($this->getName());
-    }
-}
-
-/**
- *    Accumulator for incoming case tag. Holds the
- *    incoming test structure information for
- *    later dispatch to the reporter.
-    @package SimpleTest
-    @subpackage UnitTester
- */
-class NestingCaseTag extends NestingXmlTag {
-
-    /**
-     *    Sets the basic test information except
-     *    the name.
-     *    @param hash $attributes   Name value pairs.
-     *    @access public
-     */
-    function NestingCaseTag($attributes) {
-        $this->NestingXmlTag($attributes);
-    }
-
-    /**
-     *    Signals the appropriate start event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintStart(&$listener) {
-        $listener->paintCaseStart($this->getName());
-    }
-
-    /**
-     *    Signals the appropriate end event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintEnd(&$listener) {
-        $listener->paintCaseEnd($this->getName());
-    }
-}
-
-/**
- *    Accumulator for incoming group tag. Holds the
- *    incoming test structure information for
- *    later dispatch to the reporter.
-    @package SimpleTest
-    @subpackage UnitTester
- */
-class NestingGroupTag extends NestingXmlTag {
-
-    /**
-     *    Sets the basic test information except
-     *    the name.
-     *    @param hash $attributes   Name value pairs.
-     *    @access public
-     */
-    function NestingGroupTag($attributes) {
-        $this->NestingXmlTag($attributes);
-    }
-
-    /**
-     *    Signals the appropriate start event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintStart(&$listener) {
-        $listener->paintGroupStart($this->getName(), $this->getSize());
-    }
-
-    /**
-     *    Signals the appropriate end event on the
-     *    listener.
-     *    @param SimpleReporter $listener    Target for events.
-     *    @access public
-     */
-    function paintEnd(&$listener) {
-        $listener->paintGroupEnd($this->getName());
-    }
-
-    /**
-     *    The size in the attributes.
-     *    @return integer     Value of size attribute or zero.
-     *    @access public
-     */
-    function getSize() {
-        $attributes = $this->_getAttributes();
-        if (isset($attributes['SIZE'])) {
-            return (integer)$attributes['SIZE'];
-        }
-        return 0;
-    }
-}
-
-/**
- *    Parser for importing the output of the XmlReporter.
- *    Dispatches that output to another reporter.
-    @package SimpleTest
-    @subpackage UnitTester
- */
-class SimpleTestXmlParser {
-    var $_listener;
-    var $_expat;
-    var $_tag_stack;
-    var $_in_content_tag;
-    var $_content;
-    var $_attributes;
-
-    /**
-     *    Loads a listener with the SimpleReporter
-     *    interface.
-     *    @param SimpleReporter $listener   Listener of tag events.
-     *    @access public
-     */
-    function SimpleTestXmlParser(&$listener) {
-        $this->_listener = &$listener;
-        $this->_expat = &$this->_createParser();
-        $this->_tag_stack = array();
-        $this->_in_content_tag = false;
-        $this->_content = '';
-        $this->_attributes = array();
-    }
-
-    /**
-     *    Parses a block of XML sending the results to
-     *    the listener.
-     *    @param string $chunk        Block of text to read.
-     *    @return boolean             True if valid XML.
-     *    @access public
-     */
-    function parse($chunk) {
-        if (! xml_parse($this->_expat, $chunk)) {
-            trigger_error('XML parse error with ' .
-                    xml_error_string(xml_get_error_code($this->_expat)));
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     *    Sets up expat as the XML parser.
-     *    @return resource        Expat handle.
-     *    @access protected
-     */
-    function &_createParser() {
-        $expat = xml_parser_create();
-        xml_set_object($expat, $this);
-        xml_set_element_handler($expat, '_startElement', '_endElement');
-        xml_set_character_data_handler($expat, '_addContent');
-        xml_set_default_handler($expat, '_default');
-        return $expat;
-    }
-
-    /**
-     *    Opens a new test nesting level.
-     *    @return NestedXmlTag     The group, case or method tag
-     *                             to start.
-     *    @access private
-     */
-    function _pushNestingTag($nested) {
-        array_unshift($this->_tag_stack, $nested);
-    }
-
-    /**
-     *    Accessor for current test structure tag.
-     *    @return NestedXmlTag     The group, case or method tag
-     *                             being parsed.
-     *    @access private
-     */
-    function &_getCurrentNestingTag() {
-        return $this->_tag_stack[0];
-    }
-
-    /**
-     *    Ends a nesting tag.
-     *    @return NestedXmlTag     The group, case or method tag
-     *                             just finished.
-     *    @access private
-     */
-    function _popNestingTag() {
-        return array_shift($this->_tag_stack);
-    }
-
-    /**
-     *    Test if tag is a leaf node with only text content.
-     *    @param string $tag        XML tag name.
-     *    @return @boolean          True if leaf, false if nesting.
-     *    @private
-     */
-    function _isLeaf($tag) {
-        return in_array($tag, array(
-                'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'SKIP', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
-    }
-
-    /**
-     *    Handler for start of event element.
-     *    @param resource $expat     Parser handle.
-     *    @param string $tag         Element name.
-     *    @param hash $attributes    Name value pairs.
-     *                               Attributes without content
-     *                               are marked as true.
-     *    @access protected
-     */
-    function _startElement($expat, $tag, $attributes) {
-        $this->_attributes = $attributes;
-        if ($tag == 'GROUP') {
-            $this->_pushNestingTag(new NestingGroupTag($attributes));
-        } elseif ($tag == 'CASE') {
-            $this->_pushNestingTag(new NestingCaseTag($attributes));
-        } elseif ($tag == 'TEST') {
-            $this->_pushNestingTag(new NestingMethodTag($attributes));
-        } elseif ($this->_isLeaf($tag)) {
-            $this->_in_content_tag = true;
-            $this->_content = '';
-        }
-    }
-
-    /**
-     *    End of element event.
-     *    @param resource $expat     Parser handle.
-     *    @param string $tag         Element name.
-     *    @access protected
-     */
-    function _endElement($expat, $tag) {
-        $this->_in_content_tag = false;
-        if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) {
-            $nesting_tag = $this->_popNestingTag();
-            $nesting_tag->paintEnd($this->_listener);
-        } elseif ($tag == 'NAME') {
-            $nesting_tag = &$this->_getCurrentNestingTag();
-            $nesting_tag->setName($this->_content);
-            $nesting_tag->paintStart($this->_listener);
-        } elseif ($tag == 'PASS') {
-            $this->_listener->paintPass($this->_content);
-        } elseif ($tag == 'FAIL') {
-            $this->_listener->paintFail($this->_content);
-        } elseif ($tag == 'EXCEPTION') {
-            $this->_listener->paintError($this->_content);
-        } elseif ($tag == 'SKIP') {
-            $this->_listener->paintSkip($this->_content);
-        } elseif ($tag == 'SIGNAL') {
-            $this->_listener->paintSignal(
-                    $this->_attributes['TYPE'],
-                    unserialize($this->_content));
-        } elseif ($tag == 'MESSAGE') {
-            $this->_listener->paintMessage($this->_content);
-        } elseif ($tag == 'FORMATTED') {
-            $this->_listener->paintFormattedMessage($this->_content);
-        }
-    }
-
-    /**
-     *    Content between start and end elements.
-     *    @param resource $expat     Parser handle.
-     *    @param string $text        Usually output messages.
-     *    @access protected
-     */
-    function _addContent($expat, $text) {
-        if ($this->_in_content_tag) {
-            $this->_content .= $text;
-        }
-        return true;
-    }
-
-    /**
-     *    XML and Doctype handler. Discards all such content.
-     *    @param resource $expat     Parser handle.
-     *    @param string $default     Text of default content.
-     *    @access protected
-     */
-    function _default($expat, $default) {
-    }
-}
-
