RyanHavoc's avatar

Repository using Cloud Storage. How do I test?

Hi,

I'm using Codeception and I'm writing integration tests for a repository that's using the Laravel 5 filesystem.

I want to mock the filesystem somehow in my tests. I've seen vfsStream and watched Jeffery's tutorial on how to use it on it's own but I'm at a bit of a loss as to how to use it for my situation.

Basically he repository is a MediaRepository that uploads images and videos to s3 and stores records for them in a database.

So for example the createImage() method accepts a form request which includes an image file upload and uploads the file and saves a record.

How would I test this?

Thanks

0 likes
1 reply
RyanHavoc's avatar

Also, one idea I had was to setup a MemoryAdapter for the filesystem for testing purposes as outlined here:

http://flysystem.thephpleague.com/adapter/memory/ and http://laravel.com/docs/5.0/filesystem#custom-filesystems

However my Codeception tests error with:

[BadMethodCallException] Call to undefined method League\Flysystem\Filesystem::createMemoryDriver

If anyone knows why this might be and how I can resolve it that might be a workable solution for me...

Please or to participate in this conversation.