Storage Fake and Accessing "Real" Files

Posted 4 weeks ago by chilitomato

I put all of the data files my site requires under the storage/ directory and access them with functions from the Storage fascade. During testing I use Storage::persistentFake().

This works great for files uploaded during the current test, however it appears I lose access to the 'static' data files (data files tracked by git) in my storage/ directory, which will cause various requests to fail. My desired behavior for file read functions is for the fake to first check the faked disk storage, and if the file does not exist then to fallback to the real disk. Is there any tractable way to achieve this?

As for a workaround, I am considering either storing the files required for the test in the fake disk per test, or rewriting my 'static' data file access to not use the Storage fascade, or at least to use it with a different disk also directed to storage/app/, but which will not be replaced by the call to persistentFake().

Any ideas would be appreciated :)

Please sign in or create an account to participate in this conversation.