public function testBasicExceptionsErrorHandler() { $severity = E_USER_ERROR; $message = 'test'; $file = __FILE__; $line = __LINE__ + 1; try { \vsc\exceptions_error_handler($severity, $message, $file, $line); } catch (\Exception $e) { $this->assertInstanceOf(ExceptionError::class, $e); } }
public function testCurrentMapWithInvalidRegex() { set_error_handler(function ($iSeverity, $sMessage, $sFilename, $iLineNo) { \vsc\exceptions_error_handler($iSeverity, $sMessage, $sFilename, $iLineNo); }); $sRegex = '\\'; $aMaps = array(); $aMaps[$sRegex] = new ClassMap(EmptyProcessor::class, $sRegex); $o = new RwDispatcher(); try { $o->getCurrentMap($aMaps); } catch (\ErrorException $err) { $errMessage = <<<START preg_match_all(): No ending delimiter '#' found<br/> Offending regular expression: <span style="font-weight:normal">#\\#iu</span> START; $this->assertInstanceOf(ExceptionError::class, $err); $this->assertEquals($errMessage, $err->getMessage()); } }