[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /** 3 * $Id: PHPUnit2ResultFormatter.php 3076 2006-12-18 08:52:12Z fabien $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'PHPUnit2/Framework/TestListener.php'; 23 24 require_once 'phing/system/io/Writer.php'; 25 26 /** 27 * This abstract class describes classes that format the results of a PHPUnit2 testrun. 28 * 29 * @author Michiel Rook <michiel.rook@gmail.com> 30 * @version $Id: PHPUnit2ResultFormatter.php 3076 2006-12-18 08:52:12Z fabien $ 31 * @package phing.tasks.ext.phpunit2 32 * @since 2.1.0 33 */ 34 abstract class PHPUnit2ResultFormatter implements PHPUnit2_Framework_TestListener 35 { 36 protected $out = NULL; 37 38 protected $project = NULL; 39 40 private $timer = NULL; 41 42 private $runCount = 0; 43 44 private $failureCount = 0; 45 46 private $errorCount = 0; 47 48 /** 49 * Sets the writer the formatter is supposed to write its results to. 50 */ 51 function setOutput(Writer $out) 52 { 53 $this->out = $out; 54 } 55 56 /** 57 * Returns the extension used for this formatter 58 * 59 * @return string the extension 60 */ 61 function getExtension() 62 { 63 return ""; 64 } 65 66 /** 67 * Sets the project 68 * 69 * @param Project the project 70 */ 71 function setProject(Project $project) 72 { 73 $this->project = $project; 74 } 75 76 function getPreferredOutfile() 77 { 78 return ""; 79 } 80 81 function startTestRun() 82 { 83 } 84 85 function endTestRun() 86 { 87 } 88 89 function startTestSuite(PHPUnit2_Framework_TestSuite $suite) 90 { 91 $this->runCount = 0; 92 $this->failureCount = 0; 93 $this->errorCount = 0; 94 95 $this->timer = new Timer(); 96 $this->timer->start(); 97 } 98 99 function endTestSuite(PHPUnit2_Framework_TestSuite $suite) 100 { 101 $this->timer->stop(); 102 } 103 104 function startTest(PHPUnit2_Framework_Test $test) 105 { 106 $this->runCount++; 107 } 108 109 function endTest(PHPUnit2_Framework_Test $test) 110 { 111 } 112 113 function addError(PHPUnit2_Framework_Test $test, Exception $e) 114 { 115 $this->errorCount++; 116 } 117 118 function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $t) 119 { 120 $this->failureCount++; 121 } 122 123 function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) 124 { 125 } 126 127 function addSkippedTest(PHPUnit2_Framework_Test $test, Exception $e) 128 { 129 } 130 131 function getRunCount() 132 { 133 return $this->runCount; 134 } 135 136 function getFailureCount() 137 { 138 return $this->failureCount; 139 } 140 141 function getErrorCount() 142 { 143 return $this->errorCount; 144 } 145 146 function getElapsedTime() 147 { 148 if ($this->timer) 149 { 150 return $this->timer->getElapsedTime(); 151 } 152 else 153 { 154 return 0; 155 } 156 } 157 } 158 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |