Unooks ErrorHandler's exception and error handlers, and restores PHP's defaults. May have
unexpected results if it is not matched with a prior call to run(), or if other error
handlers are set after a call to run().
public static stop ( ) |
public function tearDown() { if (ErrorHandler::isRunning()) { ErrorHandler::stop(); } }
public function testErrorTrapping() { ErrorHandler::stop(); $self = $this; ErrorHandler::config(array(array('handler' => function ($info) use($self) { $self->errors[] = $info; }))); ErrorHandler::run(array('trapErrors' => true)); $this->assertEqual(0, count($this->errors)); list($foo, $bar) = array('baz'); $this->assertEqual(1, count($this->errors)); }
public function testErrorTrapping() { ErrorHandler::stop(); ErrorHandler::run(array('trapErrors' => true)); // Undefined offset error shouldn't surface. list($foo, $bar) = array('baz'); }