Phrozn\Outputter\TestOutputter::stderr PHP Method

stderr() public method

Writes the message $msg to STDERR.
public stderr ( string $msg, string $status = self::STATUS_FAIL ) : Phrozn\Outputter
$msg string The message to output
$status string Output status
return Phrozn\Outputter
    public function stderr($msg, $status = self::STATUS_FAIL)
    {
        if (defined('STDERR')) {
            fwrite(STDERR, $msg);
        } else {
            $msg = Color::strip(Color::convert($msg));
            $this->lines[] = trim($msg);
        }
        return $this;
    }

Usage Example

 public function testStdErrWithResource()
 {
     $fp = fopen('/tmp/stderr', 'w+');
     define('STDERR', $fp);
     fclose($fp);
     $outputter = new Outputter($this);
     $outputter->stderr('sending output', '');
     $this->assertSame('sending output', trim(file_get_contents('/tmp/stderr')));
 }
All Usage Examples Of Phrozn\Outputter\TestOutputter::stderr