1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
4/**
5 * PHP Version 4
6 *
7 * Copyright (c) 2002-2005, Sebastian Bergmann <sb@sebastian-bergmann.de>.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 *   * Redistributions of source code must retain the above copyright
15 *     notice, this list of conditions and the following disclaimer.
16 *
17 *   * Redistributions in binary form must reproduce the above copyright
18 *     notice, this list of conditions and the following disclaimer in
19 *     the documentation and/or other materials provided with the
20 *     distribution.
21 *
22 *   * Neither the name of Sebastian Bergmann nor the names of his
23 *     contributors may be used to endorse or promote products derived
24 *     from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 *
39 * @category   Testing
40 * @package    PHPUnit
41 * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
42 * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
43 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
44 * @version    CVS: $Id: PHPUnit.php,v 1.17 2005/11/10 09:47:11 sebastian Exp $
45 * @link       http://pear.php.net/package/PHPUnit
46 * @since      File available since Release 1.0.0
47 */
48
49require_once 'PHPUnit/TestCase.php';
50require_once 'PHPUnit/TestResult.php';
51require_once 'PHPUnit/TestSuite.php';
52
53/**
54 * PHPUnit runs a TestSuite and returns a TestResult object.
55 *
56 * Here is an example:
57 *
58 * <code>
59 * <?php
60 * require_once 'PHPUnit.php';
61 *
62 * class MathTest extends PHPUnit_TestCase {
63 *     var $fValue1;
64 *     var $fValue2;
65 *
66 *     function MathTest($name) {
67 *       $this->PHPUnit_TestCase($name);
68 *     }
69 *
70 *     function setUp() {
71 *       $this->fValue1 = 2;
72 *       $this->fValue2 = 3;
73 *     }
74 *
75 *     function testAdd() {
76 *       $this->assertTrue($this->fValue1 + $this->fValue2 == 5);
77 *     }
78 * }
79 *
80 * $suite = new PHPUnit_TestSuite();
81 * $suite->addTest(new MathTest('testAdd'));
82 *
83 * $result = PHPUnit::run($suite);
84 * print $result->toHTML();
85 * ?>
86 * </code>
87 *
88 * Alternatively, you can pass a class name to the PHPUnit_TestSuite()
89 * constructor and let it automatically add all methods of that class
90 * that start with 'test' to the suite:
91 *
92 * <code>
93 * <?php
94 * $suite  = new PHPUnit_TestSuite('MathTest');
95 * $result = PHPUnit::run($suite);
96 * print $result->toHTML();
97 * ?>
98 * </code>
99 *
100 * @category   Testing
101 * @package    PHPUnit
102 * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
103 * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
104 * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License
105 * @version    Release: 1.3.2
106 * @link       http://pear.php.net/package/PHPUnit
107 * @since      Class available since Release 1.0.0
108 */
109class PHPUnit {
110    /**
111     * Runs a test(suite).
112     *
113     * @param  mixed
114     * @return PHPUnit_TestResult
115     * @access public
116     */
117    function &run(&$suite) {
118        $result = new PHPUnit_TestResult();
119        $suite->run($result);
120
121        return $result;
122    }
123}
124
125/*
126 * Local variables:
127 * tab-width: 4
128 * c-basic-offset: 4
129 * c-hanging-comment-ender-p: nil
130 * End:
131 */
132?>
133