Browse files

FIX: TestRunner was not cleaning up DB on failure

When a unit test being run by PHPUnit encountered a fatal error,
TestRunner::tearDown was never being called. This resulted in tmpdb schemas
littering the database from failed test runs. This changeset fixes the issue
by registering TestRunner::tearDown as a shutdown function, so that it gets
called even in the event of a PHP Fatal Error.
  • Loading branch information...
1 parent d1756a5 commit d8b106e6ee3b75561b67cdd11712432ec959ec38 @crgwbr crgwbr committed with chillu Oct 26, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 dev/TestRunner.php
6 dev/TestRunner.php 100644 → 100755
@@ -315,6 +315,12 @@ class_exists($className);
+ // Make sure TearDown is called (even in the case of a fatal error)
+ $self = $this;
+ register_shutdown_function(function() use ($self) {
+ $self->tearDown();
+ });
// get results of the PhpUnitWrapper class

0 comments on commit d8b106e

Please sign in to comment.