Example #1
0
 public function testGetDefaultExtensionIsBasedOnMimeType()
 {
     $file = new File(__DIR__ . '/Fixtures/test');
     $guesser = $this->createMockGuesser($file->getPath(), 'image/gif');
     MimeTypeGuesser::getInstance()->register($guesser);
     $this->assertEquals('.gif', $file->getDefaultExtension());
 }
Example #2
0
 /**
  * Moves the file to a new location.
  *
  * @param string $newPath
  */
 public function move($newPath)
 {
     if (!$this->moved) {
         if (!move_uploaded_file($this->getPath(), $newPath)) {
             throw new FileException(sprintf('Could not move file %s to %s', $this->getPath(), $newPath));
         }
         $this->moved = true;
     } else {
         parent::move($newPath);
     }
 }