Home » Testing » PHPUnit » Bug #5295
php warning in PHPUnit_TestCase::fail
Details
| Submitted | 2005-09-05 00:46 UTC |
|---|---|
| From | giunta dot gaetano at sea-aeroportimilano dot it |
| Status | Closed |
| Package | PHPUnit |
| PHP Version | 4.3.11 |
| OS | any |
| Roadmaps | (Not assigned) |
Comments
[2005-09-05 00:46 UTC] giunta dot gaetano at sea-aeroportimilano dot it
Description:
------------
If fail() is called from user code, no line and file info will be available in debug_backtrace info, and a warning will be generated when tryng to recover them on line 217 of TestCase.php.
Patch:
/**
* Fails a test with the given message.
*
* @param string
* @access protected
*/
function fail($message = '') {
if (function_exists('debug_backtrace')) {
$trace = debug_backtrace();
if (array_key_exists('file', $trace[1]))
// fail called upon php error having been raised
$message = sprintf(
"%s in %s:%s",
$message,
$trace[1]['file'],
$trace[1]['line']
);
}
$this->_result->addFailure($this, $message);
$this->_failed = TRUE;
}