public function testRealPath()
 {
     $this->assertNotFalse(Filesystem::realPath(self::TEST_DIRECTORY));
     $this->assertNotFalse(Filesystem::realPath(self::TEST_DIRECTORY . "/a.txt"));
     $this->assertNotFalse(Filesystem::realPath(self::TEST_DIRECTORY . "/nonexistent.txt"));
     $this->assertFalse(Filesystem::realPath(self::TEST_DIRECTORY . "/nonexistent/nonexistent.txt"));
     $this->assertSame(Filesystem::combinePaths(realpath('.'), 'text'), Filesystem::realPath('text'));
 }
Exemplo n.º 2
0
 /**
  * Save pre-uploaded file to permanent storage [stopping].
  * @param string $id file ID
  * @param string $destination destination to which the file is to be moved
  * @return bool success
  * @see getUploadedFile()
  * @see UploadManager
  */
 protected final function saveUploadedFile($id, $destination)
 {
     $src = $this->getUploadedFile($id);
     if (!$src) {
         return false;
     }
     if (!rename($src, Filesystem::realPath($destination))) {
         return $this->stop(Language::get(StringID::UploadUnsuccessful));
     }
     return true;
 }