3 // +------------------------------------------------------------------------+
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: PHPUnit.php,v 1.13 2004/10/01 06:11:39 sebastian Exp $
18 require_once 'PHPUnit/TestCase.php';
19 require_once 'PHPUnit/TestResult.php';
20 require_once 'PHPUnit/TestSuite.php';
23 * PHPUnit runs a TestSuite and returns a TestResult object.
29 * require_once 'PHPUnit.php';
31 * class MathTest extends PHPUnit_TestCase {
35 * function MathTest($name) {
36 * $this->PHPUnit_TestCase($name);
44 * function testAdd() {
45 * $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
49 * $suite = new PHPUnit_TestSuite();
50 * $suite->addTest(new MathTest('testAdd'));
52 * $result = PHPUnit::run($suite);
53 * print $result->toHTML();
57 * Alternatively, you can pass a class name to the PHPUnit_TestSuite()
58 * constructor and let it automatically add all methods of that class
59 * that start with 'test' to the suite:
63 * $suite = new PHPUnit_TestSuite('MathTest');
64 * $result = PHPUnit::run($suite);
65 * print $result->toHTML();
69 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
70 * @copyright Copyright © 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
71 * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
76 function &run(&$suite) {
77 $result = new PHPUnit_TestResult();