Permalink
Browse files

MDL-37782 reset DB after each failed database test

Conflicts:
	lib/phpunit/classes/database_driver_testcase.php
  • Loading branch information...
1 parent 2ec0ba9 commit aca26e064180b1bdf5bd6cd4b4d4562706d4798d @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
@@ -133,4 +133,21 @@ public static function tearDownAfterClass() {
phpunit_util::reset_all_data();
parent::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;
+ }
+ }
}

0 comments on commit aca26e0

Please sign in to comment.