From 95e317faff0f8984083d1c6a0a2f4a66fc1d0b9b Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 19 Jan 2011 08:53:04 +0100 Subject: [PATCH] Close #63. --- ChangeLog.markdown | 1 + PHPUnit/Framework/TestResult.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog.markdown b/ChangeLog.markdown index 783c4841e18..844d0e962ec 100644 --- a/ChangeLog.markdown +++ b/ChangeLog.markdown @@ -8,6 +8,7 @@ PHPUnit 3.6.0 * Added `assertCount()` and `assertNotCount()` to assert the number of elements in an array as well as `Countable` or `Iterator` objects. * Added `returnSelf()` to ease the mocking and stubbing of fluent interfaces. +* Implemented GH-63: Invalid `@covers` annotations should produce a test error instead of aborting PHPUnit. * Implemented GH-82: Test Skeleton Generator should create `@covers` annotations. * Implemented GH-83: Test errors and failures as well as incomplete and skipped tests now get coloured letters in the test progress. * Implemented GH-88: `@expectedException` (and `setExpectedException()`) no longer accept `Exception` as the expected exception class. diff --git a/PHPUnit/Framework/TestResult.php b/PHPUnit/Framework/TestResult.php index d364f697604..6759f6382a2 100644 --- a/PHPUnit/Framework/TestResult.php +++ b/PHPUnit/Framework/TestResult.php @@ -663,7 +663,17 @@ public function run(PHPUnit_Framework_Test $test) } if ($useXdebug) { - $this->codeCoverage->stop(!$incomplete && !$skipped); + try { + $this->codeCoverage->stop(!$incomplete && !$skipped); + } + + catch (PHP_CodeCoverage_Exception $cce) { + $error = TRUE; + + if (!isset($e)) { + $e = $cce; + } + } } if ($errorHandlerSet === TRUE) {