/**
  * Called when a caught exception needs to be output.
  */
 function paintException($exception)
 {
     // Explicitly call grandparent, not parent::paintException.
     SimpleScorer::paintException($exception);
     $message = 'Unexpected exception of type [' . get_class($exception) . '] with message [' . $exception->getMessage() . '] in [' . $exception->getFile() . ' line ' . $exception->getLine() . ']';
     $stacktrace = null;
     if (method_exists($exception, 'getTrace')) {
         $stacktrace = $exception->getTrace();
     }
     $this->_paintPassFail('exception', $message, $stacktrace);
 }
Example #2
0
 /**
  *    Reporter to be run inside of Eclipse interface.
  *    @param object $listener   Eclipse listener (?).
  *    @param boolean $cc        Whether to include test coverage.
  */
 function __construct(&$listener, $cc = false)
 {
     $this->_listener =& $listener;
     parent::__construct();
     $this->_case = "";
     $this->_group = "";
     $this->_method = "";
     $this->_cc = $cc;
     $this->_error = false;
     $this->_fail = false;
 }
Example #3
0
 /**
  * Paints a PHP error.
  * @param string $message Message is ignored.
  */
 public function paintError($message)
 {
     // Explicitly call grandparent, not HtmlReporter::paintError.
     SimpleScorer::paintError($message);
     print "<span class=\"fail\">Exception</span>: <br />\n";
     $breadcrumb = $this->getTestList();
     array_shift($breadcrumb);
     print implode(" -&gt; ", $breadcrumb);
     print "<br />\n<strong>" . $this->htmlEntities($message) . "</strong><br />\n";
     print "<pre>\n";
 }
Example #4
0
 /**
  *    Reporter to be run inside of Eclipse interface.
  *    @param object $listener   Eclipse listener (?).
  *    @param boolean $cc        Whether to include test coverage.
  */
 function __construct($listener, $cc = false)
 {
     parent::__construct();
     $this->listener = $listener;
     $this->case = "";
     $this->group = "";
     $this->method = "";
     $this->cc = $cc;
     $this->message = "";
     $this->error = false;
     $this->fail = false;
     $this->pass = false;
 }
 /**
  * Called when a caught exception needs to be output.
  */
 function paintException($exception)
 {
     // Explicitly call grandparent, not parent::paintException.
     SimpleScorer::paintException($exception);
     if (is_a($exception, 'moodle_exception') && !get_string_manager()->string_exists($exception->errorcode, $exception->module)) {
         $exceptionmessage = 'Exception with missing language string {' . $exception->errorcode . '} from language file {' . $exception->module . '}';
         if (!empty($exception->a)) {
             if (is_string($exception->a)) {
                 $data = $exception->a;
             } else {
                 $data = array();
                 foreach ((array) $exception->a as $name => $value) {
                     $data[] = $name . ' => [' . $value . ']';
                 }
                 $data = implode(', ', $data);
             }
             $exceptionmessage .= ' with data {' . $data . '}';
         }
     } else {
         $exceptionmessage = $exception->getMessage();
     }
     $message = 'Unexpected exception of type [' . get_class($exception) . '] with message [' . $exceptionmessage . '] in [' . $exception->getFile() . ' line ' . $exception->getLine() . ']';
     $debuginfo = null;
     if (!empty($exception->debuginfo)) {
         $debuginfo = $exception->debuginfo;
     }
     $this->_paintPassFail('exception', $message, $exception->getTrace(), $debuginfo);
 }
Example #6
0
 /**
  * Starts the display with no results in.
  */
 public function __construct()
 {
     parent::__construct();
     $this->test_stack = array();
     $this->size = null;
     $this->progress = 0;
 }
Example #7
0
 /**
  * Called when an error (uncaught exception or PHP error) needs to be output.
  */
 function paintError($message)
 {
     // Explicitly call grandparent, not parent::paintFail.
     SimpleScorer::paintError($message);
     $this->_paintPassFail('exception', $message);
 }
Example #8
0
 /**
  *    Starts the display with no results in.
  *    @access public
  */
 function __construct()
 {
     parent::__construct();
     $this->_test_stack = array();
     $this->_size = null;
     $this->_progress = 0;
 }
Example #9
0
 /**
  *    Paints a PHP error.
  *    @param string $message        Message is ignored.
  *    @access public
  */
 function paintError($message)
 {
     SimpleScorer::paintError($message);
     print "<span class=\"fail\"><b>EXCEPTION</b></span>: ";
     $breadcrumb = $this->getTestList();
     array_shift($breadcrumb);
     print implode(" -&gt; ", $breadcrumb);
     print " -&gt; <strong>" . $this->_htmlEntities($message) . "</strong><br />\n";
 }