/** * @param $id * @return string */ private function filePathById($id) { if (is_file($f = $this->permanentStoragePath . $id)) { return $f; } return $this->permanentStoragePath . nonlinear\generateDestination($id) . $id; }
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()); }
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; }
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)); }