[ Index ] |
|
Code source de LifeType 1.2.4 |
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 49 define( "PHPUNIT_CLASS_PATH", PLOG_CLASS_PATH."class/test/" ); 50 51 lt_include(PHPUNIT_CLASS_PATH.'PHPUnit/TestCase.php'); 52 lt_include(PHPUNIT_CLASS_PATH.'PHPUnit/TestResult.php'); 53 lt_include(PHPUNIT_CLASS_PATH.'PHPUnit/TestSuite.php'); 54 55 /** 56 * PHPUnit runs a TestSuite and returns a TestResult object. 57 * 58 * Here is an example: 59 * 60 * <code> 61 * <?php 62 * require_once 'PHPUnit.php'; 63 * 64 * class MathTest extends PHPUnit_TestCase { 65 * var $fValue1; 66 * var $fValue2; 67 * 68 * function MathTest($name) { 69 * $this->PHPUnit_TestCase($name); 70 * } 71 * 72 * function setUp() { 73 * $this->fValue1 = 2; 74 * $this->fValue2 = 3; 75 * } 76 * 77 * function testAdd() { 78 * $this->assertTrue($this->fValue1 + $this->fValue2 == 5); 79 * } 80 * } 81 * 82 * $suite = new PHPUnit_TestSuite(); 83 * $suite->addTest(new MathTest('testAdd')); 84 * 85 * $result = PHPUnit::run($suite); 86 * print $result->toHTML(); 87 * ?> 88 * </code> 89 * 90 * Alternatively, you can pass a class name to the PHPUnit_TestSuite() 91 * constructor and let it automatically add all methods of that class 92 * that start with 'test' to the suite: 93 * 94 * <code> 95 * <?php 96 * $suite = new PHPUnit_TestSuite('MathTest'); 97 * $result = PHPUnit::run($suite); 98 * print $result->toHTML(); 99 * ?> 100 * </code> 101 * 102 * @category Testing 103 * @package PHPUnit 104 * @author Sebastian Bergmann <sb@sebastian-bergmann.de> 105 * @copyright 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de> 106 * @license http://www.opensource.org/licenses/bsd-license.php BSD License 107 * @version Release: @package_version@ 108 * @link http://pear.php.net/package/PHPUnit 109 * @since Class available since Release 1.0.0 110 */ 111 class PHPUnit { 112 /** 113 * Runs a test(suite). 114 * 115 * @param mixed 116 * @return PHPUnit_TestResult 117 * @access public 118 */ 119 function &run(&$suite) { 120 $result = new PHPUnit_TestResult(); 121 $suite->run($result); 122 123 return $result; 124 } 125 } 126 127 /* 128 * Local variables: 129 * tab-width: 4 130 * c-basic-offset: 4 131 * c-hanging-comment-ender-p: nil 132 * End: 133 */ 134 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |