Permalink
Browse files

- Merge [3832].

  • Loading branch information...
1 parent 1bfb4a6 commit 9eaf99a597f956f9a348e560e9b78576882fe541 @sebastianbergmann committed Oct 12, 2008
Showing with 24 additions and 3 deletions.
  1. +24 −3 PHPUnit/Util/Filter.php
View
@@ -402,9 +402,11 @@ public static function getFilteredStacktrace(Exception $e, $filterTests = TRUE,
$eTrace = $e->getTrace();
- array_unshift(
- $eTrace, array('file' => $e->getFile(), 'line' => $e->getLine())
- );
+ if (!self::frameExists($eTrace, $e->getFile(), $e->getLine())) {
+ array_unshift(
+ $eTrace, array('file' => $e->getFile(), 'line' => $e->getLine())
+ );
+ }
foreach ($eTrace as $frame) {
if (!self::$filter || (isset($frame['file']) && !self::isFiltered($frame['file'], $filterTests, TRUE))) {
@@ -534,6 +536,25 @@ public static function getCoveredFiles()
{
return self::$coveredFiles;
}
+
+ /**
+ * @param array $trace
+ * @param string $file
+ * @param int $line
+ * @return boolean
+ * @since Method available since Release 3.3.2
+ */
+ public static function frameExists(array $trace, $file, $line)
+ {
+ foreach ($trace as $frame) {
+ if (isset($frame['file']) && $frame['file'] == $file &&
+ isset($frame['line']) && $frame['line'] == $line) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+ }
}
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');

0 comments on commit 9eaf99a

Please sign in to comment.