premier commit
[bazdig.git] / test / PHPUnit / TestFailure.php
blob08d6c9dd3e0a142f80ec5b7d4d829fe6141ca7b0
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: TestFailure.php,v 1.8 2004/10/01 06:11:39 sebastian Exp $
18 /**
19 * A TestFailure collects a failed test together with the caught exception.
21 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
22 * @copyright Copyright &copy; 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>
23 * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
24 * @category Testing
25 * @package PHPUnit
27 class PHPUnit_TestFailure {
28 /**
29 * @var object
30 * @access private
32 var $_failedTest;
34 /**
35 * @var string
36 * @access private
38 var $_thrownException;
40 /**
41 * Constructs a TestFailure with the given test and exception.
43 * @param object
44 * @param string
45 * @access public
47 function PHPUnit_TestFailure(&$failedTest, &$thrownException) {
48 $this->_failedTest = $failedTest;
49 $this->_thrownException = $thrownException;
52 /**
53 * Gets the failed test.
55 * @return object
56 * @access public
58 function &failedTest() {
59 return $this->_failedTest;
62 /**
63 * Gets the thrown exception.
65 * @return object
66 * @access public
68 function &thrownException() {
69 return $this->_thrownException;
72 /**
73 * Returns a short description of the failure.
75 * @return string
76 * @access public
78 function toString() {
79 return sprintf(
80 "TestCase %s->%s() failed: %s\n",
82 get_class($this->_failedTest),
83 $this->_failedTest->getName(),
84 $this->_thrownException