コード例 #1
0
 /**
  * @param int $severity
  * @param string $message
  * @param string $file
  * @param int $line
  * @param int $sourceTraceStartIndex
  */
 public function __construct($severity, $message, $file, $line, $sourceTraceStartIndex)
 {
     parent::__construct($message, 0, $severity, $file, $line);
     $this->sourceTraceStartIndex = (int) $sourceTraceStartIndex;
 }
コード例 #2
0
 public function test()
 {
     $exception = new ErrorException(E_NOTICE, 'message', 'file', 0, 1);
     $this->assertSame(E_NOTICE, $exception->getSeverity());
     $this->assertSame('message', $exception->getMessage());
     $this->assertSame('Notice', $exception->getSeverityAsString());
     $this->assertSame('E_NOTICE', $exception->getSeverityAsConstantName());
     $this->assertSame('file', $exception->getFile());
     $this->assertSame(0, $exception->getLine());
     $sourceTrace = array_slice($exception->getTrace(), 1);
     $this->assertSame($sourceTrace, $exception->getSourceTrace());
     $this->assertSame(StackTraceFormatter::format($exception->getSourceTrace()), $exception->getSourceTraceAsString());
     $this->assertSame('exception \'Hyperframework\\Common\\ErrorException\' ' . "with message 'message' in file:0" . PHP_EOL . 'Stack trace:' . PHP_EOL . $exception->getSourceTraceAsString(), (string) $exception);
 }