function it_generate_path_for_fsi_file_with_external_adapter(File $file, Filesystem $filesystem, Local $adapter)
 {
     $file->getKey()->willReturn('Test Folder/File/nazwy plików.jpg');
     $file->getFilesystem()->willReturn($filesystem);
     $filesystem->getAdapter()->willReturn($adapter);
     $file->getContent()->willReturn('file content');
     $this->filePath($file)->shouldReturn('/uploaded/Test Folder/File/nazwy plików.jpg');
 }
 function it_generate_url_for_fsi_file_with_external_adapter(File $file, Filesystem $filesystem, Local $adapter)
 {
     $file->getKey()->shouldBeCalled()->willReturn('TestFolder/File/file.jpg');
     $file->getFilesystem()->shouldBeCalled()->willReturn($filesystem);
     $filesystem->getAdapter()->willReturn($adapter);
     $file->getContent()->shouldBeCalled()->willReturn('file content');
     $this->fileAsset($file)->shouldReturn('/TestFolder/File/file.jpg');
     $this->filePath($file)->shouldReturn('/TestFolder/File/file.jpg');
 }
コード例 #3
0
 function it_saves_file_and_calls_symfony_validator(ImageValidator $imageValidator, File $constraint, FSiFile $file)
 {
     $file->getContent()->willReturn('file content');
     $imageValidator->validate(Argument::containingString('/tmp/'), $constraint)->shouldBeCalled();
     $this->validate($file, $constraint);
 }
コード例 #4
0
 /**
  * @param \FSi\DoctrineExtensions\Uploadable\File $file
  * @throws \RuntimeException
  * @throws \OutOfBoundsException
  * @throws \Gaufrette\Exception\FileNotFound
  */
 protected function writeFileToLocalAdapter(File $file)
 {
     if (!$this->getLocalAdapter()->exists($file->getKey())) {
         $this->getLocalAdapter()->write($file->getKey(), $file->getContent());
     }
 }