Exemplo n.º 1
0
 public function testFrom()
 {
     $backtrace = \r8\Backtrace::from(array(array('file' => '/tmp/backtrace.php', 'line' => 11, 'function' => '{closure}', 'args' => array()), array('function' => 'stat', 'class' => 'tmp', 'type' => '::', 'args' => array()), array('file' => '/tmp/backtrace.php', 'line' => 24, 'function' => 'meth', 'class' => 'tmp', 'type' => '->', 'args' => array()), array('file' => '/tmp/backtrace.php', 'line' => 27, 'function' => 'execute', 'args' => array())));
     $this->assertThat($backtrace, $this->isInstanceOf('\\r8\\Backtrace'));
     $this->assertThat($backtrace->getEvent(0), $this->isInstanceOf('\\r8\\Backtrace\\Event\\Closure'));
     $this->assertThat($backtrace->getEvent(1), $this->isInstanceOf('\\r8\\Backtrace\\Event\\StaticMethod'));
     $this->assertThat($backtrace->getEvent(2), $this->isInstanceOf('\\r8\\Backtrace\\Event\\Method'));
     $this->assertThat($backtrace->getEvent(3), $this->isInstanceOf('\\r8\\Backtrace\\Event\\Func'));
     $this->assertThat($backtrace->getEvent(4), $this->isInstanceOf('\\r8\\Backtrace\\Event\\Main'));
 }
Exemplo n.º 2
0
 /**
  * Returns the backtrace that lead up to this error
  *
  * @return \r8\Backtrace
  */
 public function getBacktrace()
 {
     if (!isset($this->backtrace)) {
         $this->backtrace = \r8\Backtrace::from($this->exception->getTrace());
         $this->backtrace->unshiftEvent(new \r8\Backtrace\Event\Func("throw", $this->exception->getFile(), $this->exception->getLine(), array($this->exception)));
     }
     return $this->backtrace;
 }