public function testCreate() { $trace = \r8\Backtrace::create(); $this->assertThat($trace, $this->isInstanceOf('\\r8\\Backtrace')); $this->assertGreaterThan(1, count($trace)); $this->assertThat($trace->getEvent(-1), $this->isInstanceOf('\\r8\\Backtrace\\Event\\Main')); $first = $trace->getEvent(0); $this->assertThat($first, $this->isInstanceOf('r8\\Backtrace\\Event\\Method')); $this->assertSame(__CLASS__, $first->getClass()); $this->assertSame(__FUNCTION__, $first->getName()); }
*/ \r8\Autoload::getInstance()->register('r8', r8_DIR_CLASSES)->register('r8\\iface', r8_DIR_INTERFACES)->register('r8\\Test', r8_DIR_TEST); spl_autoload_register(array(\r8\Autoload::getInstance(), "load")); /** * Take a snapshot of the environment */ \r8\Env::Request(); /** * Set up error handling, but only if it isn't being suppressed by the including code */ if (!defined("r8_SUPPRESS_HANDLERS")) { // Register the error handler set_error_handler(function ($code, $message, $file, $line) { $level = (int) ini_get('error_reporting'); $code = (int) $code; if (!($code & $level)) { return TRUE; } $backtrace = \r8\Backtrace::create()->popEvent(); \r8\Error::getInstance()->handle(new \r8\Error\PHP($file, $line, $code, $message, $backtrace)); }); // Register an exception handler set_exception_handler(function ($exception) { \r8\Error::getInstance()->handle(new \r8\Error\Exception($exception)); }); // Hook in the error handler to the error log \r8\Error::getInstance()->register(new \r8\Error\Handler\Stream(new \r8\Error\Formatter\JSON(\r8\Env::request()), new \r8\Stream\Out\ErrorLog())); // Hook in the error handler to output the error to the client \r8\Error::getInstance()->register(new \r8\Error\Handler\IniDisplay(new \r8\Error\Handler\Stream(\r8\Env::request()->isCLI() ? new \r8\Error\Formatter\Text(\r8\Env::request()) : new \r8\Error\Formatter\HTML(\r8\Env::request()), new \r8\Stream\Out\StdOut()))); } // @codeCoverageIgnoreEnd