Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4] Storage fake and fake files. #18178

Merged
merged 5 commits into from
Mar 1, 2017
Merged

[5.4] Storage fake and fake files. #18178

merged 5 commits into from
Mar 1, 2017

Conversation

taylorotwell
Copy link
Member

@taylorotwell taylorotwell commented Mar 1, 2017

This allows you to fake a storage disk which replaces it with a local
disk pointing into the storage/framework/testing directory. This also
includes a way to generate “Fake” uploaded files, especially images, by
doing:

Storage::fake('foo')

UploadedFile::fake()->image(‘name.jpg’, $width, $height)->size(100)

Storage::disk('foo')->assertExists('name.jpg')

Storage::disk('foo')->assertMissing('name.jpg')

You may spoof the size of the image by doing ->size(300) where 300 is the
number of kilobytes the file will report as its size.

This allows you to fake a storage disk which replaces it with a local
disk pointing into the storage/framework/testing directory. This also
includes a way to generate “Fake” uploaded files, especially images, by
doing: UploadedFile::fake()->image(‘name.jpg’, width, height)… you may
also spoof the size of the image by doing ->size(300) where 300 is the
number of kilobytes the file will report as its size.
@GrahamCampbell GrahamCampbell changed the title Storage fake and fake files. [5.4] Storage fake and fake files. Mar 1, 2017
@taylorotwell taylorotwell merged commit 504bcff into 5.4 Mar 1, 2017
@GrahamCampbell GrahamCampbell deleted the storage-fakes branch March 1, 2017 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant