/**
  * Get the stderr object for the console error handling.
  *
  * @return ConsoleOutput
  */
 public static function getStderr()
 {
     if (empty(self::$stderr)) {
         self::$stderr = new ConsoleOutput('php://stderr');
     }
     return self::$stderr;
 }
 public function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     try {
         $e = new ErrorException($description, 0, $code, $file, $line);
         self::sentryLog($e);
         return parent::handleError($code, $description, $file, $line, $context);
     } catch (Exception $e) {
         self::handleException($e);
     }
 }
 /**
  * setup, create mocks
  *
  * @return Mock object
  */
 public function setUp()
 {
     parent::setUp();
     $this->Error = $this->getMock('ConsoleErrorHandler', array('_stop'));
     ConsoleErrorHandler::$stderr = $this->getMock('ConsoleOutput', array(), array(), '', false);
 }
Ejemplo n.º 4
0
 /**
  * test a Error500 exception.
  *
  * @return void
  */
 public function testError500Exception()
 {
     $exception = new InternalErrorException('dont use me in cli.');
     ConsoleErrorHandler::$stderr->expects($this->once())->method('write')->with($this->stringContains('dont use me in cli.'));
     ConsoleErrorHandler::handleException($exception);
 }