protected function setUp()
 {
     BrowserConsoleHandler::reset();
 }
Example #2
0
 /**
  * @global type $container
  * @param type $path
  * @param type $filename
  * @return BinaryFileResponse
  */
 protected function downloadFile($path, $filename)
 {
     global $container;
     $session = $container->get('session');
     $session->save();
     $filenameFallback = str_replace('%', '_', $filename);
     $filenameFallback = str_replace('/', '_', $filenameFallback);
     $filenameFallback = str_replace('\\', '_', $filenameFallback);
     $response = new BinaryFileResponse($path);
     $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename, $filenameFallback);
     if (pathinfo($filename, PATHINFO_EXTENSION) == 'docx') {
         $response->headers->set('Content-Type', '');
         // otherwise mineType would be zip
     }
     $logger = $container->get("logger");
     $logger->pushHandler(new NullHandler(Logger::DEBUG));
     BrowserConsoleHandler::reset();
     return $response;
 }