Permalink
Browse files

MDL-37782 reset DB after each failed database test

  • Loading branch information...
1 parent 48bf094 commit 0fe975bbf2bf68d4c7c8e5dd082856f54240eb1b @skodak skodak committed with stronk7 Mar 24, 2013
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/phpunit/classes/database_driver_testcase.php
@@ -135,6 +135,23 @@ public static function tearDownAfterClass() {
}
/**
+ * Runs the bare test sequence.
+ * @return void
+ */
+ public function runBare() {
+ try {
+ parent::runBare();
+
+ } catch (Exception $e) {
+ if ($this->tdb->is_transaction_started()) {
+ $this->tdb->force_transaction_rollback();
+ }
+ $this->tearDown();
+ throw $e;
+ }
+ }
+
+ /**
* Return debugging messages from the current test.
* @return array with instances having 'message', 'level' and 'stacktrace' property.
*/

0 comments on commit 0fe975b

Please sign in to comment.