* @license PHP License * @package Wombat * @subpackage unittest */ /** * Unit Test * * TestBaseClass * * @version 0.1.2 * @package Wombat * @subpackage unittest */ class TestCaseError extends UnitTestCase { public function testErrorHandler() { $killLevel = WBParam::get('wb/error/killlevel', E_ERROR); $this->assertTrue(($killLevel & E_ERROR) > 0, 'Kill level must include E_ERROR'); $this->assertTrue(class_exists('WBErrorHandler', false)); $eh = WBClass::create('WBUT_ErrorHandler'); /** @var $eh WBUT_ErrorHandler */ $this->assertTrue($eh->checkLogger(), 'Logger must be there'); $msg = $eh->getMsgFatal(); $this->assertTrue(!empty($msg)); } public function testExceptionHandler() { $this->assertTrue(class_exists('WBErrorHandler_Exception', false)); } public function testPhp() { $this->assertTrue(class_exists('WBErrorHandler_Php', false)); } public function testPat() { WBClass::load('WBErrorHandler_Pat'); $this->assertTrue(class_exists('WBErrorHandler_Pat', false)); $this->assertTrue(class_exists('patErrorManager', false)); $hdl = patErrorManager::getErrorHandling(E_ERROR); $this->assertEqual($hdl['mode'], 'callback'); $this->assertIsA($hdl['options'][0], 'WBErrorHandler_Pat'); $this->assertEqual($hdl['options'][1], 'handleError'); $hdl = patErrorManager::getErrorHandling(E_WARNING); $this->assertEqual($hdl['mode'], 'callback'); $this->assertIsA($hdl['options'][0], 'WBErrorHandler_Pat'); $this->assertEqual($hdl['options'][1], 'handleWarning'); $hdl = patErrorManager::getErrorHandling(E_NOTICE); //$this->assertEqual($hdl['mode'], 'ignore'); $this->assertIsA($hdl['options'][0], 'WBErrorHandler_Pat'); $this->assertEqual($hdl['options'][1], 'handleNotice'); } } ?>