コード例 #1
0
ファイル: Test.php プロジェクト: kalkin/solarphp
 /**
  * 
  * Returns the output from Solar_Debug_Var::fetch() for a variable.
  * 
  * @param mixed $var The variable dump.
  * 
  * @return string
  * 
  */
 protected function _export($var)
 {
     return trim($this->_debug->fetch($var));
 }
コード例 #2
0
ファイル: Suite.php プロジェクト: btweedy/foresmo
 /**
  * 
  * Formats a test line, logs it, and saves the info.
  * 
  * @param int $exit Pass, skip, todo, or fail.
  * 
  * @param string $name The test name.
  * 
  * @param string $note Additional note about the test.
  * 
  * @param string $diag Diagnostics for the test.
  * 
  * @return void
  * 
  */
 protected function _done($exit, $name, $note = null, $diag = null)
 {
     $this->_info['done']++;
     $text = '';
     if (is_array($diag) || is_object($diag)) {
         $diag = $this->_var->dump($diag);
     }
     $diag = trim($diag);
     if ($diag) {
         $text = "{$text}\n# " . str_replace("\n", "\n# ", trim($diag));
     }
     if ($text) {
         $text .= "\n";
     }
     $num = $this->_info['done'];
     $note = ltrim($note, '# ');
     switch ($exit) {
         case Solar_Test::EXIT_FAIL:
             $type = 'fail';
             $text .= "not ok {$num} - {$name} # FAIL {$note}";
             break;
         case Solar_Test::EXIT_TODO:
             $type = 'todo';
             $text .= "not ok {$num} - {$name} # TODO {$note}";
             break;
         case Solar_Test::EXIT_SKIP:
             $type = 'skip';
             $text .= "ok {$num} - {$name} # SKIP {$note}";
             break;
         case Solar_Test::EXIT_PASS:
             $type = 'pass';
             $text .= "ok {$num} - {$name}";
             break;
         default:
             $type = 'fail';
             $text .= "not ok {$num} - {$name} # FAIL exit code '{$exit}'";
             break;
     }
     $this->_test_result = $type;
     $this->_log($text);
     $this->_info[$type][$name] = array($num, $note);
 }
コード例 #3
0
 /**
  * 
  * Runs var_dump() on a variable and stores that
  * output to be displayed in the debugger
  * 
  * @param mixed $var Variable to be displayed
  * 
  * @param string $label Label for the variable
  * 
  * @return void
  * 
  */
 public function varDump($var, $label)
 {
     // put var_dump() output into an array with $label as the key
     $this->_debug['solar_debug_var'][$label] = $this->_debug_var->fetch($var);
 }