You are here

public function PHPUnit_Util_Log_JSON::write in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Log/JSON.php \PHPUnit_Util_Log_JSON::write()

Parameters

string $buffer:

Overrides PHPUnit_Util_Printer::write

3 calls to PHPUnit_Util_Log_JSON::write()
PHPUnit_Util_Log_JSON::startTest in vendor/phpunit/phpunit/src/Util/Log/JSON.php
A test started.
PHPUnit_Util_Log_JSON::startTestSuite in vendor/phpunit/phpunit/src/Util/Log/JSON.php
A testsuite started.
PHPUnit_Util_Log_JSON::writeCase in vendor/phpunit/phpunit/src/Util/Log/JSON.php

File

vendor/phpunit/phpunit/src/Util/Log/JSON.php, line 227

Class

PHPUnit_Util_Log_JSON
A TestListener that generates JSON messages.

Code

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));
}