Ejemplo n.º 1
0
 /** @expectedException \Elephander\Exceptionizer\UserWarning */
 public function testTriggersUserWarning()
 {
     $eh = new ErrorHandler();
     $eh->registerSelf();
     Exceptionizer::registerWith($eh, Exceptionizer::IncludeWarnings);
     trigger_error("user warning", E_USER_WARNING);
 }
Ejemplo n.º 2
0
 public function testCallsLateLast()
 {
     $calledLate = false;
     $eh = new ErrorHandler();
     $eh->addErrorHandler(E_USER_WARNING, '/test late/', function () use(&$calledLate) {
         $this->assertEquals(false, $calledLate);
     }, ErrorHandler::Normal);
     $eh->addErrorHandler(E_USER_WARNING, '/test late/', function () use(&$calledLate) {
         $this->assertEquals(false, $calledLate);
         $calledLate = true;
         return true;
     }, ErrorHandler::Late);
     $eh->registerSelf();
     trigger_error("test late last", E_USER_WARNING);
     $this->assertEquals(true, $calledLate);
 }
Ejemplo n.º 3
0
 /** Registers this instance with the given ErrorHandler. */
 public function registerWith(ErrorHandler $eh)
 {
     return $eh->addErrorHandler(E_RECOVERABLE_ERROR, '/^Argument (\\d)+ passed to (?:([\\w\\\\]+)::)?(\\w+)\\(\\) must be an instance of ([\\w\\\\]+), ([\\w\\\\]+) given/', [$this, 'handleError']);
 }