/**
  * @return void
  */
 protected function handle()
 {
     $this->writeLog();
     $error = $this->getError();
     if ($error instanceof Error && $error->isFatal() === false) {
         return;
     }
     if ($this->isDebuggerEnabled) {
         $this->flushInnerOutputBuffer();
         $output = $this->getOutput();
         $this->deleteOutputBuffer();
         if (Response::headersSent() === false) {
             $this->rewriteHttpHeaders();
         }
         $this->executeDebugger($output);
         ini_set('display_errors', '0');
     } elseif (Response::headersSent() === false) {
         $this->rewriteHttpHeaders();
         if (Config::getBool('hyperframework.web.error_view.enable', true)) {
             $this->deleteOutputBuffer();
             $this->renderErrorView();
             ini_set('display_errors', '0');
         }
     }
 }
 public function testHeadersSent()
 {
     $this->mockEngineMethod('headersSent')->willReturn(true);
     $this->assertTrue(Response::headersSent());
 }