Laravel Testing: Storage fake "Maximum function nesting level of '256' reached, aborting" #2141
Unanswered
FrazeColder
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have written a few tests for my own project but I am facing a strange error... My test should test if a image passes the validation rules, gets uploaded and really exists under the given path. For that I am mocking my storing as described in the docs with
Storage::fake
.Also, I am using this technique to mock the
Storage::fake
path for the spatie media library which I am using.This is my test:
Here now comes the problems:
When running this tests (or even all tests where I test if I can upload an image and it exist) in row, it works like a charm. No problem at all!
When running ALL my tests, I get the problem that
$this->assertTrue(Storage::disk($fake_storage_disk)->exists($user->id . '/' . $filename));
fails because it is sayingUnable to assert that false is true
. This actually means, the file doens't exists.However, when I am trying to
dd(Storage::disk($fake_storage_disk)->exists($user->id . '/' . $filename))
to check where the problem is I get this error:What also confuses me is why he is throwing this error in this line
$this->assertTrue(Storage::disk($fake_storage_disk)->exists($user->id . '/' . $filename));
and not at the beginning when initializingStorage::fake
. However, I get the same error when trying todd(..)
theStorage::fake
...Any ideas on how to solve this or where the problem is? Also, why the heck does it work when running it as a single test and also with other uploading tests but when running it with ALL other tests I have it fails?
Kind regards and thank you!
Beta Was this translation helpful? Give feedback.
All reactions