public function testHandlerReturnsFalseWillAbortStackAndRethrow() { $exception = new Exception(); $this->exHandler->shouldReceive('handle')->with($exception)->andReturn(false); $handler = new ErrorHandler($this->exHandler); try { $handler->handleException($exception); } catch (Exception $ex) { $rethrown = $ex; } $this->assertSame($ex, $rethrown); }
public function testHandlerThrowsExceptionWillAbortStackAndRethrow() { $exHandler1 = new GenericHandler([Exception::CLASS], function ($ex) { throw $ex; }); $called = false; $exHandler2 = new GenericHandler([Exception::CLASS], function ($ex) use(&$called) { $called = true; return false; }); $handler = new ErrorHandler(); $handler->addHandlers([$exHandler1, $exHandler2]); $exception = new Exception(); try { $handler->handleException($exception); } catch (Exception $ex) { $rethrown = $ex; } $this->assertSame($ex, $rethrown); $this->assertSame(false, $called); }