Example #1
0
 /**
  * @param $id
  * @return string
  */
 private function filePathById($id)
 {
     if (is_file($f = $this->permanentStoragePath . $id)) {
         return $f;
     }
     return $this->permanentStoragePath . nonlinear\generateDestination($id) . $id;
 }
Example #2
0
 public function testIsContentSavedInFileSystemInGroupDirectory()
 {
     $id = $this->cache()->save(Test\Data::gif1x1(), new Request('/adm/7yU98sd_1x1.gif'));
     $path = $this->cache_path . nonlinear\generateDestination($id);
     $expectedPath = $path . '/adm/7yU98sd/7yU98sd_1x1.gif';
     $this->assertEquals(file_get_contents($expectedPath), Test\Data::gif1x1());
 }
Example #3
0
 private function filePath(Request $request)
 {
     $file = self::directoryByRequest($request);
     if (is_file($f = $this->path . $file)) {
         return $f;
     }
     return $this->path . nonlinear\generateDestination($request->id) . $file;
 }
Example #4
0
 public function testIsFileSavedInNonLinearStructure()
 {
     $id = $this->storage()->save(Test\Data::gif1x1());
     $path = $this->storage_path . nonlinear\generateDestination($id);
     $this->assertCount(5, array_filter(explode(DIRECTORY_SEPARATOR, $path), function ($item) {
         return !empty($item);
     }));
     $content = file_get_contents($path . $id);
     $this->assertEquals($content, $this->storage()->getById($id));
 }