@ -16,6 +16,13 @@ require_once dirname(__FILE__) . '/../../exception/ErrorHandler.php';
class ErrorHandlerTest extends PHPUnit_Framework_TestCase
{
public $old_eh = array ( 'PHPUnit_Util_ErrorHandler' , 'handleError' );
public function setUp ()
{
set_error_handler ( array ( 'ErrorHandler' , 'error_handler' ));
ob_start ();
}
public function testErrorHandlerInit ()
{
@ -37,8 +44,6 @@ class ErrorHandlerTest extends PHPUnit_Framework_TestCase
public function testShowDebug ()
{
ob_start ();
echo PHP_EOL . 'some string' . PHP_EOL . PHP_EOL ;
try {
throw new ErrorException ( " test error " , E_USER_ERROR );
} catch ( ErrorException $e ) {
@ -47,6 +52,12 @@ class ErrorHandlerTest extends PHPUnit_Framework_TestCase
$this -> assertStringStartsWith ( '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' , $result );
$this -> assertStringEndsWith ( '</html>' , $result );
}
}
public function tearDown ()
{
set_error_handler ( $this -> old_eh );
}
}