[moodle] / moodle / lib / weblib.php Repository:

Diff of /moodle/lib/weblib.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1339, Fri Sep 25 14:17:38 2009 WST revision 1.1340, Thu Oct 1 02:06:45 2009 WST

By tjhunt:

unit tests: MDL-20398 spurious exceptions when $CFG->debugdisplay is false

# Line 3136  Line 3136 
3136   * @return bool   * @return bool
3137   */   */
3138  function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {  function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
3139      global $CFG;      global $CFG, $UNITTEST;
3140    
3141      if (empty($CFG->debug) || $CFG->debug < $level) {      if (empty($CFG->debug) || $CFG->debug < $level) {
3142          return false;          return false;
# Line 3151  Line 3151 
3151              $backtrace = debug_backtrace();              $backtrace = debug_backtrace();
3152          }          }
3153          $from = format_backtrace($backtrace, CLI_SCRIPT);          $from = format_backtrace($backtrace, CLI_SCRIPT);
3154          if ($CFG->debugdisplay) {          if ($CFG->debugdisplay || empty($UNITTEST->running)) {
3155                    // When the unit tests are running, any call to trigger_error
3156                    // is intercepted by the test framework and reported as an exception.
3157                    // Therefore, we cannot use trigger_error during unit tests.
3158                    // At the same time I do not think we should just discard those messages,
3159                    // so displaying them on-screen seems like the only option. (MDL-20398)
3160              if (!defined('DEBUGGING_PRINTED')) {              if (!defined('DEBUGGING_PRINTED')) {
3161                  define('DEBUGGING_PRINTED', 1); // indicates we have printed something                  define('DEBUGGING_PRINTED', 1); // indicates we have printed something
3162              }              }

Legend:
Removed from v.1.1339  
changed lines
  Added in v.1.1340

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7