Example #1
0
 /**
  * HTML Output should be correctly formatted
  */
 public function testWriteOutput()
 {
     $expected = file_get_contents(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . 'HtmlTestOutput.html');
     $expected = preg_replace('/datetime/', date('Y/m/d H:i:s'), $expected);
     $this->expectOutputString($expected);
     $obj = new Html();
     $obj->addTimestamp()->write("test message");
     $obj->write("test message 2");
     $obj->flush();
 }
Example #2
0
 /**
  * A fall-back channel which just outputs to console/stderr/browser
  *
  * @static
  * @return ChannelAbstract
  * @throws \Exception
  */
 public static function Basic()
 {
     try {
         if (PHP_SAPI == 'cli') {
             if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
                 $oComms = new Console();
             } else {
                 $oComms = new StdErr();
             }
             return $oComms;
         } else {
             $oComms = new Html();
             if (isset($_SERVER['HTTP_USER_AGENT']) && substr($_SERVER['HTTP_USER_AGENT'], 0, 13) == 'HTTP%20Client') {
                 ini_set('html_errors', 0);
                 // disable HTML markup in errors (works on xDebug too)
                 $oComms->setBasicClient();
             }
             return $oComms;
         }
     } catch (\Exception $ex) {
         throw $ex;
     }
 }