Merge branch 'wip-MDL-32395-m23' of git://github.com/samhemelryk/moodle
[moodle.git] / lib / dml / moodle_database.php
index 9341b86..faf097e 100644 (file)
@@ -323,7 +323,11 @@ abstract class moodle_database {
             $lowesttransaction = end($this->transactions);
             $backtrace = $lowesttransaction->get_backtrace();
 
             $lowesttransaction = end($this->transactions);
             $backtrace = $lowesttransaction->get_backtrace();
 
-            error_log('Potential coding error - active database transaction detected when disposing database:'."\n".format_backtrace($backtrace, true));
+            if (defined('PHPUNIT_TEST') and PHPUNIT_TEST) {
+                //no need to log sudden exits in our PHPunit test cases
+            } else {
+                error_log('Potential coding error - active database transaction detected when disposing database:'."\n".format_backtrace($backtrace, true));
+            }
             $this->force_transaction_rollback();
         }
         if ($this->used_for_db_sessions) {
             $this->force_transaction_rollback();
         }
         if ($this->used_for_db_sessions) {