protected function withFileServiceCreateReturningFile($id = false)
 {
     if (!$id) {
         $id = $this->fileId;
     }
     $this->mockFileService->expects($this->once())->method('create')->willReturn(new $this->fileEntityClass(['id' => $id]));
 }
 /**
  * @expectedException \Exception
  */
 public function testFailedSaveThrowsException()
 {
     $this->withFileInserted();
     $this->service->setSaveThrowsException(true);
     $request = $this->getUploadRequest();
     $request->files = new FileBag();
     $request->files->add([$this->getUploadedFile()]);
     $this->service->create($request, $this->mapper);
 }