* @copyright 2004/2005 by gERD Schaufelberger
* @package wombatSite
* @subpackage test
**/
include_once '../include/wbFactory.php';
wbFactory::configure();
echo "
Ask debugger whether it is active: ";
if( wbDebugger::isActive() ) {
echo 'ON';
}
else {
echo 'OFF';
}
echo "
\n";
// add some custom error message
$myArray = array(
'text' => 'some text message',
'data' => array( 1, 2, 7, 9 ),
'more' => 'more, more, more'
);
wbDebugger::addMsg( 'Part 1', 'Detailed message', 'Message title' );
wbDebugger::addMsg( 'Part 1', 'Detailed message', 'Message title' );
wbDebugger::addMsg( 'Part 1', wbDebugger::sprint_r( $myArray ), 'My Array' );
wbDebugger::addMsg( 'Part 1', 'Detailed message', 'Message title' );
wbDebugger::addMsg( 'another part', 'Detailed message', 'Message title' );
wbDebugger::addMsg( 'another part', 'Detailed message', 'Message title' );
// forward patErrors to debugger
//patErrorManager::raiseError( 'gsTest:1', 'TestError', 'Test Error Message' );
patErrorManager::raiseWarning( 'gsTest:2', 'TestWarning', 'Test Warning Message' );
patErrorManager::raiseWarning( 'gsTest:2', 'TestWarning', 'Test Warning Message' );
patErrorManager::raiseNotice( 'gsTest:3', 'TestNotice', 'Test Notice Message' );
// this should generate a warning...
generateWarning();
// classes
$em =& new errorMaker();
$em->process();
// forward PHP-Errors to debugger
include_once 'non/existing/file';
trigger_error( 'My personal warning', E_USER_WARNING );
trigger_error( 'Just a notice', E_USER_NOTICE );
//trigger_error( 'Fatal user error', E_USER_ERROR );
wbDebugger::printMsg();
exit( 0 );
/**
* just a test function
*
* @access private
* @return boolean $result true on success
*/
function testErrorHandler()
{
return testErrorHandler2();
}
/**
* just a test function
*
* @access private
* @return boolean $result true on success
*/
function testErrorHandler()
{
return generateWarning();
}
/**
* just a test function
*
* @access private
* @return boolean $result true on success
*/
function generateWarning()
{
return patErrorManager::raiseWarning( 'gsTest:createWarning:1', 'Test Warning Message', 'Test Warning Info Message' );
}
/**
*
*
* @version 0.1
* @package
* @subpackage
*/
class errorMaker
{
/**
* do some important stuff
*
*
* @access private
* @return boolean $result true on success
*/
function process()
{
return $this->_doPrivateStuff();
}
/**
* do something that failes
*
*
* @access private
* @return boolean $result true on success
*/
function _doPrivateStuff()
{
// something failed and therefore
$this->_generateError();
return false;
}
/**
*
*
*
* @access private
* @return boolean $result true on success
*/
function _generateError()
{
return patErrorManager::raiseWarning( 'Make Error', 'Test Errors for Backtrace', 'Backtrace tester...' );
}
}
?>