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.
This commit is contained in:
Craig Weber 2012-10-26 20:54:08 +00:00 committed by Ingo Schommer
parent d1756a5a58
commit d8b106e6ee

6
dev/TestRunner.php Normal file → Executable file
View File

@ -315,6 +315,12 @@ class TestRunner extends Controller {
$phpunitwrapper->setSuite($suite);
$phpunitwrapper->setCoverageStatus($coverage);
// Make sure TearDown is called (even in the case of a fatal error)
$self = $this;
register_shutdown_function(function() use ($self) {
$self->tearDown();
});
$phpunitwrapper->runTests();
// get results of the PhpUnitWrapper class