/**
  * Disable Kohana PHP error handling.
  *
  * @return  void
  */
 public static function disable()
 {
     if (Kohana_PHP_Exception::$enabled) {
         restore_error_handler();
         Event::clear('system.shutdown', array('Kohana_PHP_Exception', 'shutdown_handler'));
         Kohana_PHP_Exception::$enabled = FALSE;
     }
 }
Exemple #2
0
 /**
  * Cleans up the PHP environment. Disables error/exception handling and the
  * auto-loading method and closes the output buffer.
  *
  * This method does not need to be called during normal system execution,
  * however in some advanced situations it can be helpful. @see #1781
  *
  * @return  void
  */
 public static function cleanup()
 {
     static $run;
     // Only run this function once
     if ($run === TRUE) {
         return;
     }
     $run = TRUE;
     Kohana_Exception::disable();
     Kohana_PHP_Exception::disable();
     spl_autoload_unregister(array('Kohana', 'auto_load'));
     Kohana::close_buffers();
 }
<?php

defined('SYSPATH') or die('No direct access allowed.');
if (class_exists('PHPUnit_Util_Filter')) {
    // Hand control of errors and exceptions to PHPUnit
    if (defined('Kohana::VERSION')) {
        Kohana_Exception::disable();
        Kohana_PHP_Exception::disable();
    } else {
        restore_exception_handler();
        restore_error_handler();
    }
    Event::clear('system.ready');
    Event::clear('system.routing');
    Event::clear('system.execute');
}