/** * @param \Dvs\FileBundle\Adapter\FlySystem\Local $filesystem * @param \Dvs\PathGenerator\Interfaces\PathGenerator $pathGenerator */ public function it_should_create_file_from_resource($filesystem, $pathGenerator) { $subDirectories = $this->getSubDirectories(); $directory = 'directory'; $file = File::create($filename = 'filename', $directory . DIRECTORY_SEPARATOR . $subDirectories, $resource = 'resource'); $pathGenerator->generatePathFromName($filename)->willReturn($subDirectories); $filesystem->getPathPrefix()->willReturn('/root'); $filesystem->writeFile($file)->shouldBeCalled(); $this->create($filename, $resource, $directory)->shouldBeLike($file); }
/** * @param File $file * @param string $newFileName */ private function renameTempFile(File $file, string $newFileName) { $fullPath = $this->prependRootPath($newFileName); rename($file->getFileName(), $fullPath); chmod($fullPath, 0775); }