Exemplo n.º 1
0
 public function testSendErrorsWithErrors()
 {
     $client = $this->getClientMock();
     $client->expects($this->once())->method('sendReport');
     $error = $this->getErrorMock();
     $errorHandler = $this->getErrorHandlerMock();
     $errorHandler->expects($this->once())->method('getErrors')->will($this->returnValue(array($error)));
     $report = $this->getReportMock();
     $reportFactory = $this->getReportFactoryMock();
     $reportFactory->expects($this->once())->method('createFromErrors')->will($this->returnValue($report));
     $shutdownHandler = new ShutdownHandler($client, $errorHandler, $reportFactory);
     $shutdownHandler->sendErrors();
 }
Exemplo n.º 2
0
 /**
  * Registers a shutdown handler.
  *
  * @param Client       $client
  * @param ErrorHandler $handler
  * @param array        $application
  *
  * @return ShutdownHandler
  */
 private static function registerShutdownHandler(Client $client, ErrorHandler $handler, array $application)
 {
     return ShutdownHandler::register($client, $handler, new ReportFactory(self::createApplication($application), Request::createFromGlobals(), Server::createFromGlobals()));
 }