Пример #1
0
 /**
  * @param string $buffer
  */
 public function write($buffer)
 {
     array_walk_recursive($buffer, function (&$input) {
         if (is_string($input)) {
             $input = PHPUnit_Util_String::convertToUtf8($input);
         }
     });
     $flags = 0;
     if (defined('JSON_PRETTY_PRINT')) {
         $flags |= JSON_PRETTY_PRINT;
     }
     parent::write(json_encode($buffer, $flags));
 }
 /**
  * @param string $status
  * @param float  $time
  * @param array  $trace
  * @param string $message
  */
 protected function writeCase($status, $time, array $trace = array(), $message = '', $test = NULL)
 {
     $output = '';
     if ($test !== NULL && $test->hasOutput()) {
         $output = $test->getActualOutput();
     }
     $this->write(array('event' => 'test', 'suite' => $this->currentTestSuiteName, 'test' => $this->currentTestName, 'status' => $status, 'time' => $time, 'trace' => $trace, 'message' => PHPUnit_Util_String::convertToUtf8($message), 'output' => $output));
 }
Пример #3
0
 /**
  * Escapes a string for the use in XML documents
  * Any Unicode character is allowed, excluding the surrogate blocks, FFFE,
  * and FFFF (not even as character reference).
  * See http://www.w3.org/TR/xml/#charsets
  *
  * @param  string $string
  * @return string
  * @since  Method available since Release 3.4.6
  */
 public static function prepareString($string)
 {
     return preg_replace('/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]/', '', htmlspecialchars(PHPUnit_Util_String::convertToUtf8($string), ENT_QUOTES, 'UTF-8'));
 }
Пример #4
0
 /**
  * @param string $buffer
  */
 public function write($buffer)
 {
     array_walk_recursive($buffer, function (&$input) {
         if (is_string($input)) {
             $input = PHPUnit_Util_String::convertToUtf8($input);
         }
     });
     parent::write(json_encode($buffer, JSON_PRETTY_PRINT));
 }
Пример #5
0
 /**
  * @param  string $string
  * @return string
  * @author Kore Nordmann <*****@*****.**>
  * @since  Method available since Release 3.4.6
  */
 public static function prepareString($string)
 {
     return preg_replace('([\\x00-\\x04\\x0b\\x0c\\x0e-\\x1f\\x7f])e', 'sprintf( "&#x%02x;", ord( "\\1" ) )', htmlspecialchars(PHPUnit_Util_String::convertToUtf8($string), ENT_COMPAT, 'UTF-8'));
 }
Пример #6
0
 /**
  * @param  string $string
  *
  * @return string
  * @author Kore Nordmann <*****@*****.**>
  * @since  Method available since Release 3.4.6
  */
 public static function prepareString($string)
 {
     return preg_replace_callback('/[\\x00-\\x04\\x0b\\x0c\\x0e-\\x1f\\x7f]/', function ($matches) {
         return sprintf('&#x%02x;', ord($matches[0]));
     }, htmlspecialchars(PHPUnit_Util_String::convertToUtf8($string), ENT_COMPAT, 'UTF-8'));
 }
Пример #7
0
 /**
  * @param string $buffer
  */
 public function write($buffer)
 {
     array_walk_recursive($buffer, function (&$input) {
         if (is_string($input)) {
             $input = PHPUnit_Util_String::convertToUtf8($input);
         }
     });
     $this->testOutput[] = $buffer;
 }
Пример #8
0
 /**
  * @param string $status
  * @param float  $time
  * @param array  $trace
  * @param string $message
  */
 protected function writeCase($status, $time, array $trace = array(), $message = '')
 {
     $this->write(array('event' => 'test', 'suite' => $this->currentTestSuiteName, 'test' => $this->currentTestName, 'status' => $status, 'time' => $time, 'trace' => $trace, 'message' => PHPUnit_Util_String::convertToUtf8($message)));
 }