/** * Test JError::setErrorHandling * * @return void */ public function testSetErrorHandling() { JErrorInspector::manipulateLevels(array(E_NOTICE => 'Notice', E_WARNING => 'Warning', E_ERROR => 'Error')); $errorHandling = JErrorInspector::inspectHandlers(); $this->assertThat(JError::setErrorHandling(E_NOTICE, 'message'), $this->isTrue(), 'Setting a message error handler failed'); $handlers = JErrorInspector::inspectHandlers(); $this->assertThat($handlers[E_NOTICE], $this->equalTo(array('mode' => 'message')), 'The error handler did not get set to message'); $this->assertThat(JError::setErrorHandling(E_NOTICE, 'callback', array($this, 'callbackHandler')), $this->isTrue(), 'Setting a message error handler failed'); $handlers = JErrorInspector::inspectHandlers(); $this->assertThat($handlers[E_NOTICE], $this->equalTo(array('mode' => 'callback', 'options' => array($this, 'callbackHandler'))), 'The error handler did not get set to callback'); JErrorInspector::manipulateHandlers($errorHandling); }
/** * Stub method to set $stack * * @param array $stack An array of error stacks * * @return void */ public static function manipulateStack($stack) { self::$stack = $stack; }