Skip to content
This repository

Catch unhandled exceptions thrown out of setUpBeforeClass functions #196

Merged
merged 1 commit into from almost 3 years ago

4 participants

Oleg Pudeyev Nils Adermann Benjamin Eberlei Sebastian Bergmann
Oleg Pudeyev
p commented March 11, 2011

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

Nils Adermann

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

Benjamin Eberlei

+1 had an issue with this last week

Sebastian Bergmann sebastianbergmann merged commit 7662ece into from June 10, 2011
Sebastian Bergmann sebastianbergmann closed this June 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 11, 2011
Oleg Pudeyev Catch unhandled exceptions thrown out of setUpBeforeClass functions 5ce4210
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  PHPUnit/Framework/TestSuite.php
10  PHPUnit/Framework/TestSuite.php
@@ -665,6 +665,16 @@ public function run(PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE
665 665
 
666 666
                 return $result;
667 667
             }
  668
+            
  669
+            catch (Exception $e) {
  670
+                $numTests = count($this);
  671
+                
  672
+                for ($i = 0; $i < $numTests; $i++) {
  673
+                    $result->addError($this, $e, 0);
  674
+                }
  675
+                
  676
+                return $result;
  677
+            }
668 678
         }
669 679
 
670 680
         if (empty($groups)) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.