premier commit
[bazdig.git] / test / PHPUnit / TestListener.php
blob80a2f6da59a452bba1943a14faa42d0ee4926ac2
1 <?php
2 //
3 // +------------------------------------------------------------------------+
4 // | PEAR :: PHPUnit |
5 // +------------------------------------------------------------------------+
6 // | Copyright (c) 2002-2003 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
7 // +------------------------------------------------------------------------+
8 // | This source file is subject to version 3.00 of the PHP License, |
9 // | that is available at http://www.php.net/license/3_0.txt. |
10 // | If you did not receive a copy of the PHP license and are unable to |
11 // | obtain it through the world-wide-web, please send a note to |
12 // | license@php.net so we can mail you a copy immediately. |
13 // +------------------------------------------------------------------------+
15 // $Id: TestListener.php,v 1.8 2004/10/01 06:11:39 sebastian Exp $
18 /**
19 * A Listener for test progress.
21 * Here is an example:
23 * <code>
24 * <?php
25 * require_once 'PHPUnit.php';
26 * require_once 'PHPUnit/TestListener.php';
28 * class MathTest extends PHPUnit_TestCase {
29 * var $fValue1;
30 * var $fValue2;
32 * function MathTest($name) {
33 * $this->PHPUnit_TestCase($name);
34 * }
36 * function setUp() {
37 * $this->fValue1 = 2;
38 * $this->fValue2 = 3;
39 * }
41 * function testAdd() {
42 * $this->assertTrue($this->fValue1 + $this->fValue2 == 4);
43 * }
44 * }
46 * class MyListener extends PHPUnit_TestListener {
47 * function addError(&$test, &$t) {
48 * print "MyListener::addError() called.\n";
49 * }
51 * function addFailure(&$test, &$t) {
52 * print "MyListener::addFailure() called.\n";
53 * }
55 * function endTest(&$test) {
56 * print "MyListener::endTest() called.\n";
57 * }
59 * function startTest(&$test) {
60 * print "MyListener::startTest() called.\n";
61 * }
62 * }
64 * $suite = new PHPUnit_TestSuite;
65 * $suite->addTest(new MathTest('testAdd'));
67 * $result = new PHPUnit_TestResult;
68 * $result->addListener(new MyListener);
70 * $suite->run($result);
71 * print $result->toString();
72 * ?>
73 * </code>
75 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
76 * @copyright Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
77 * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
78 * @category Testing
79 * @package PHPUnit
81 class PHPUnit_TestListener {
82 /**
83 * An error occurred.
85 * @param object
86 * @param object
87 * @access public
88 * @abstract
90 function addError(&$test, &$t) { /*abstract */ }
92 /**
93 * A failure occurred.
95 * @param object
96 * @param object
97 * @access public
98 * @abstract
100 function addFailure(&$test, &$t) { /*abstract */ }
103 * A test ended.
105 * @param object
106 * @access public
107 * @abstract
109 function endTest(&$test) { /*abstract */ }
112 * A test started.
114 * @param object
115 * @access public
116 * @abstract
118 function startTest(&$test) { /*abstract */ }