Merge branch 'w13_MDL-37782_m25_testtrans' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 26 Mar 2013 15:09:06 +0000 (16:09 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 26 Mar 2013 15:09:06 +0000 (16:09 +0100)
lib/phpunit/classes/database_driver_testcase.php

index 4f56eb8..f354429 100644 (file)
@@ -134,6 +134,23 @@ abstract class database_driver_testcase extends PHPUnit_Framework_TestCase {
         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;
+        }
+    }
+
     /**
      * Return debugging messages from the current test.
      * @return array with instances having 'message', 'level' and 'stacktrace' property.