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: TestListener.php,v 1.12 2005/11/10 09:47:15 sebastian Exp $ 45 * @link http://pear.php.net/package/PHPUnit 46 * @since File available since Release 1.0.0 47 */ 48 49/** 50 * A Listener for test progress. 51 * 52 * Here is an example: 53 * 54 * <code> 55 * <?php 56 * require_once 'PHPUnit.php'; 57 * require_once 'PHPUnit/TestListener.php'; 58 * 59 * class MathTest extends PHPUnit_TestCase { 60 * var $fValue1; 61 * var $fValue2; 62 * 63 * function MathTest($name) { 64 * $this->PHPUnit_TestCase($name); 65 * } 66 * 67 * function setUp() { 68 * $this->fValue1 = 2; 69 * $this->fValue2 = 3; 70 * } 71 * 72 * function testAdd() { 73 * $this->assertTrue($this->fValue1 + $this->fValue2 == 4); 74 * } 75 * } 76 * 77 * class MyListener extends PHPUnit_TestListener { 78 * function addError(&$test, &$t) { 79 * print "MyListener::addError() called.\n"; 80 * } 81 * 82 * function addFailure(&$test, &$t) { 83 * print "MyListener::addFailure() called.\n"; 84 * } 85 * 86 * function endTest(&$test) { 87 * print "MyListener::endTest() called.\n"; 88 * } 89 * 90 * function startTest(&$test) { 91 * print "MyListener::startTest() called.\n"; 92 * } 93 * } 94 * 95 * $suite = new PHPUnit_TestSuite; 96 * $suite->addTest(new MathTest('testAdd')); 97 * 98 * $result = new PHPUnit_TestResult; 99 * $result->addListener(new MyListener); 100 * 101 * $suite->run($result); 102 * print $result->toString(); 103 * ?> 104 * </code> 105 * 106 * @category Testing 107 * @package PHPUnit 108 * @author Sebastian Bergmann <sb@sebastian-bergmann.de> 109 * @copyright 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de> 110 * @license http://www.opensource.org/licenses/bsd-license.php BSD License 111 * @version Release: 1.3.2 112 * @link http://pear.php.net/package/PHPUnit 113 * @since Class available since Release 1.0.0 114 */ 115class PHPUnit_TestListener { 116 /** 117 * An error occurred. 118 * 119 * @param object 120 * @param object 121 * @access public 122 * @abstract 123 */ 124 function addError(&$test, &$t) { /*abstract */ } 125 126 /** 127 * A failure occurred. 128 * 129 * @param object 130 * @param object 131 * @access public 132 * @abstract 133 */ 134 function addFailure(&$test, &$t) { /*abstract */ } 135 136 /** 137 * A test ended. 138 * 139 * @param object 140 * @access public 141 * @abstract 142 */ 143 function endTest(&$test) { /*abstract */ } 144 145 /** 146 * A test started. 147 * 148 * @param object 149 * @access public 150 * @abstract 151 */ 152 function startTest(&$test) { /*abstract */ } 153} 154 155/* 156 * Local variables: 157 * tab-width: 4 158 * c-basic-offset: 4 159 * c-hanging-comment-ender-p: nil 160 * End: 161 */ 162?> 163