j'ai merge le message d'erreur quand bazdig.db n'est pas ouvert en ecriture et j...
[bazdig.git] / test / PHPUnit.php
blob1528878104d6adc2c99fc315683e7f25c8e6caf5
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: 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';
22 /**
23 * PHPUnit runs a TestSuite and returns a TestResult object.
25 * Here is an example:
27 * <code>
28 * <?php
29 * require_once 'PHPUnit.php';
31 * class MathTest extends PHPUnit_TestCase {
32 * var $fValue1;
33 * var $fValue2;
35 * function MathTest($name) {
36 * $this->PHPUnit_TestCase($name);
37 * }
39 * function setUp() {
40 * $this->fValue1 = 2;
41 * $this->fValue2 = 3;
42 * }
44 * function testAdd() {
45 * $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
46 * }
47 * }
49 * $suite = new PHPUnit_TestSuite();
50 * $suite->addTest(new MathTest('testAdd'));
52 * $result = PHPUnit::run($suite);
53 * print $result->toHTML();
54 * ?>
55 * </code>
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:
61 * <code>
62 * <?php
63 * $suite = new PHPUnit_TestSuite('MathTest');
64 * $result = PHPUnit::run($suite);
65 * print $result->toHTML();
66 * ?>
67 * </code>
69 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
70 * @copyright Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
71 * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
72 * @category Testing
73 * @package PHPUnit
75 class PHPUnit {
76 function &run(&$suite) {
77 $result = new PHPUnit_TestResult();
78 $suite->run($result);
80 return $result;