public function testOutputReadFileError()
 {
     $path = __FILE__;
     $this->output->expects($this->once())->method('getHttpResponseCode')->will($this->returnValue(Http::STATUS_OK));
     $this->output->expects($this->once())->method('setReadfile')->will($this->returnValue(false));
     $this->output->expects($this->once())->method('setHttpResponseCode')->with($this->equalTo(Http::STATUS_BAD_REQUEST));
     $response = new StreamResponse($path);
     $response->callback($this->output);
 }
 /**
  * Streams the file using readfile
  *
  * @param IOutput $output a small wrapper that handles output
  * @since 8.1.0
  */
 public function callback(IOutput $output)
 {
     // handle caching
     if ($output->getHttpResponseCode() !== Http::STATUS_NOT_MODIFIED) {
         if (!file_exists($this->filePath)) {
             $output->setHttpResponseCode(Http::STATUS_NOT_FOUND);
         } elseif ($output->setReadfile($this->filePath) === false) {
             $output->setHttpResponseCode(Http::STATUS_BAD_REQUEST);
         }
     }
 }