Skip to content

[5.4] Storage fake and fake files. - #18178

Merged
taylorotwell merged 5 commits into
5.4from
storage-fakes
Mar 1, 2017
Merged

taylorotwell merged 5 commits into
5.4from
storage-fakes

Conversation

@taylorotwell

@taylorotwell taylorotwell commented Mar 1, 2017

Copy link
Copy Markdown
Member

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