public function PHPUnit_Util_Printer::__construct

Constructor.

Parameters

mixed $out:

Throws

PHPUnit_Framework_Exception

4 calls to PHPUnit_Util_Printer::__construct()
PHPUnit_TextUI_ResultPrinter::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php
Constructor.
PHPUnit_Util_Log_JUnit::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Log/JUnit.php
Constructor.
PHPUnit_Util_Log_TAP::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Log/TAP.php
Constructor.
PHPUnit_Util_TestDox_ResultPrinter::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/TestDox/ResultPrinter.php
Constructor.
4 methods override PHPUnit_Util_Printer::__construct()
PHPUnit_TextUI_ResultPrinter::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php
Constructor.
PHPUnit_Util_Log_JUnit::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Log/JUnit.php
Constructor.
PHPUnit_Util_Log_TAP::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Log/TAP.php
Constructor.
PHPUnit_Util_TestDox_ResultPrinter::__construct in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/TestDox/ResultPrinter.php
Constructor.

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Printer.php, line 87

Class

PHPUnit_Util_Printer
Utility class that can print to STDOUT or write to a file.

Code

public function __construct($out = NULL) {
  if ($out !== NULL) {
    if (is_string($out)) {
      if (strpos($out, 'socket://') === 0) {
        $out = explode(':', str_replace('socket://', '', $out));
        if (sizeof($out) != 2) {
          throw new PHPUnit_Framework_Exception();
        }
        $this->out = fsockopen($out[0], $out[1]);
      }
      else {
        if (strpos($out, 'php://') === FALSE && !is_dir(dirname($out))) {
          mkdir(dirname($out), 0777, TRUE);
        }
        $this->out = fopen($out, 'wt');
      }
      $this->outTarget = $out;
    }
    else {
      $this->out = $out;
    }
  }
}