public function getPath(File $file, $absolute = true)
 {
     if (!$file->getId()) {
         throw new \RuntimeException('File must be persisted');
     }
     $basename = $file->getId();
     if ($this->preserveExtension) {
         $extension = $file->getExtension();
         if ($extension) {
             $basename .= '.' . $extension;
         }
     }
     return $this->getDir($file, $absolute) . '/' . $basename;
 }
Esempio n. 2
0
 public function testGetExtension()
 {
     $file = new File();
     $file->setName('example.TXT');
     $this->assertEquals('txt', $file->getExtension());
 }