Skip to content

Loading…

Catch unhandled exceptions thrown out of setUpBeforeClass functions #196

Merged
merged 1 commit into from

4 participants

@p
p commented

Currently if setUpBeforeClass throws an exception the entire test run is killed.

@naderman

Just seen this crash a test suite without proper information on errors/failures. Would be very helpful if this could be merged.

@beberlei

+1 had an issue with this last week

@sebastianbergmann sebastianbergmann merged commit 7662ece into sebastianbergmann:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 10 additions and 0 deletions.
  1. +10 −0 PHPUnit/Framework/TestSuite.php
View
10 PHPUnit/Framework/TestSuite.php
@@ -665,6 +665,16 @@ public function run(PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE
return $result;
}
+
+ catch (Exception $e) {
+ $numTests = count($this);
+
+ for ($i = 0; $i < $numTests; $i++) {
+ $result->addError($this, $e, 0);
+ }
+
+ return $result;
+ }
}
if (empty($groups)) {
Something went wrong with that request. Please try again.