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()); }
/** * 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); } }