function testControllerAndAction()
 {
     Exceptional::$controller = "home";
     Exceptional::$action = "index";
     $this->createExceptionData();
     $this->assertEquals($this->request["controller"], "home");
     $this->assertEquals($this->request["action"], "index");
 }
Beispiel #2
0
 static function setup($api_key, $use_ssl = false)
 {
     if ($api_key == "") {
         $api_key = null;
     }
     self::$api_key = $api_key;
     self::$use_ssl = $use_ssl;
     self::$exceptions = array();
     self::$context = array();
     self::$action = "";
     self::$controller = "";
     // set exception handler & keep old exception handler around
     self::$previous_exception_handler = set_exception_handler(array("Exceptional", "handle_exception"));
     self::$previous_error_handler = set_error_handler(array("Exceptional", "handle_error"));
     register_shutdown_function(array("Exceptional", "shutdown"));
 }
Beispiel #3
0
}
set_error_handler("my_error_handler");
// set custom exception handler
function my_exception_handler($exception)
{
    echo "Exception thrown: " . $exception->getMessage() . "\n";
}
set_exception_handler("my_exception_handler");
// setup Exceptional with the following two lines
// this code must come **after** you set custom error/exception handlers
require dirname(__FILE__) . "/../exceptional.php";
Exceptional::setup("YOUR-API-KEY", true);
// use ssl
// add controller and action
Exceptional::$controller = "welcome";
Exceptional::$action = "index";
// add context
$context = array("user_id" => 1);
Exceptional::context($context);
// control which errors are caught with error_reporting
error_reporting(E_ALL | E_STRICT);
// start testing
echo $hi;
$math = 1 / 0;
function backtrace($i)
{
    if ($i < 6) {
        return backtrace($i + 1);
    }
    echo $cool;
}