public function testRequestAccessors() { $request = \r8\Env::Request(); $this->assertThat($request, $this->isInstanceOf('\\r8\\iface\\Env\\Request')); $this->assertSame($request, \r8\Env::Request()); $this->assertSame($request, \r8\Env::Request()); $this->assertSame($request, \r8\Env::Request()); }
/** * Constructor... Sets the initial state of the instance */ public function __construct() { // Set the default action URI to the current page $this->action = \r8\Env::Request()->getURL()->__toString(); }
/** * Dumps the results of this test suite to the client * * @return \r8\Benchmark\Suite */ public function dump() { return \r8\Env::Request()->isCLI() ? $this->dumpCLI() : $this->dumpHTML(); }
* @param Object $object The input object * @return Object Returns the input object */ function r8($object) { return $object; } /** * Register the autoloader */ \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