Make testsiote compatible with php 7.2, 1st pass
[plcapi.git] / test / PHPUnit / TestFailure.php
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
4 /**
5  * PHP Version 4
6  *
7  * LICENSE: This source file is subject to version 3.0 of the PHP license
8  * that is available through the world-wide-web at the following URI:
9  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
10  * the PHP License and are unable to obtain it through the web, please
11  * send a note to license@php.net so we can mail you a copy immediately.
12  *
13  * @category   Testing
14  * @package    PHPUnit
15  * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
16  * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
17  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
18  * @version    CVS: $Id$
19  * @link       http://pear.php.net/package/PHPUnit
20  * @since      File available since Release 1.0.0
21  */
22
23 /**
24  * A TestFailure collects a failed test together with the caught exception.
25  *
26  * @category   Testing
27  * @package    PHPUnit
28  * @author     Sebastian Bergmann <sb@sebastian-bergmann.de>
29  * @copyright  2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
30  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
31  * @version    Release: @package_version@
32  * @link       http://pear.php.net/package/PHPUnit
33  * @since      Class available since Release 1.0.0
34  */
35 class PHPUnit_TestFailure {
36     /**
37      * @var    object
38      * @access private
39      */
40     var $_failedTest;
41
42     /**
43      * @var    string
44      * @access private
45      */
46     var $_thrownException;
47
48     /**
49      * Constructs a TestFailure with the given test and exception.
50      *
51      * @param  object
52      * @param  string
53      * @access public
54      */
55     function __construct(&$failedTest, &$thrownException) {
56         $this->_failedTest      = &$failedTest;
57         $this->_thrownException = &$thrownException;
58     }
59
60     /**
61      * Gets the failed test.
62      *
63      * @return object
64      * @access public
65      */
66     function &failedTest() {
67         return $this->_failedTest;
68     }
69
70     /**
71      * Gets the thrown exception.
72      *
73      * @return object
74      * @access public
75      */
76     function &thrownException() {
77         return $this->_thrownException;
78     }
79
80     /**
81      * Returns a short description of the failure.
82      *
83      * @return string
84      * @access public
85      */
86     function toString() {
87         return sprintf(
88           "TestCase %s->%s() failed: %s\n",
89
90           get_class($this->_failedTest),
91           $this->_failedTest->getName(),
92           $this->_thrownException
93         );
94     }
95 }
96
97 /*
98  * Local variables:
99  * tab-width: 4
100  * c-basic-offset: 4
101  * c-hanging-comment-ender-p: nil
102  * End:
103  */
104 ?>