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