123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- /**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage Extensions
- * @author Rene vd O (original code)
- * @author Perrick Penet
- * @author Marcus Baker
- * @version $Id: recorder.php 2011 2011-04-29 08:22:48Z pp11 $
- */
- /**
- * include other SimpleTest class files
- */
- require_once(dirname(__FILE__) . '/scorer.php');
- /**
- * A single test result.
- * @package SimpleTest
- * @subpackage Extensions
- */
- abstract class SimpleResult {
- public $time;
- public $breadcrumb;
- public $message;
- /**
- * Records the test result as public members.
- * @param array $breadcrumb Test stack at the time of the event.
- * @param string $message The messsage to the human.
- */
- function __construct($breadcrumb, $message) {
- list($this->time, $this->breadcrumb, $this->message) =
- array(time(), $breadcrumb, $message);
- }
- }
- /**
- * A single pass captured for later.
- * @package SimpleTest
- * @subpackage Extensions
- */
- class SimpleResultOfPass extends SimpleResult { }
- /**
- * A single failure captured for later.
- * @package SimpleTest
- * @subpackage Extensions
- */
- class SimpleResultOfFail extends SimpleResult { }
- /**
- * A single exception captured for later.
- * @package SimpleTest
- * @subpackage Extensions
- */
- class SimpleResultOfException extends SimpleResult { }
- /**
- * Array-based test recorder. Returns an array
- * with timestamp, status, test name and message for each pass and failure.
- * @package SimpleTest
- * @subpackage Extensions
- */
- class Recorder extends SimpleReporterDecorator {
- public $results = array();
- /**
- * Stashes the pass as a SimpleResultOfPass
- * for later retrieval.
- * @param string $message Pass message to be displayed
- * eventually.
- */
- function paintPass($message) {
- parent::paintPass($message);
- $this->results[] = new SimpleResultOfPass(parent::getTestList(), $message);
- }
- /**
- * Stashes the fail as a SimpleResultOfFail
- * for later retrieval.
- * @param string $message Failure message to be displayed
- * eventually.
- */
- function paintFail($message) {
- parent::paintFail($message);
- $this->results[] = new SimpleResultOfFail(parent::getTestList(), $message);
- }
- /**
- * Stashes the exception as a SimpleResultOfException
- * for later retrieval.
- * @param string $message Exception message to be displayed
- * eventually.
- */
- function paintException($message) {
- parent::paintException($message);
- $this->results[] = new SimpleResultOfException(parent::getTestList(), $message);
- }
- }
- ?>
|