1

我有这样的要求:

$path = storage_path('testing/unnamed.png');
        $original_name = 'unnamed';
        $mime_type = 'image/png';
        $size = 2192;
        $error = null;
        $test = true;

        $file = new UploadedFile($path, $original_name, $mime_type, $size, $error, $test);



        $response = $this->call('POST', 'games', [
            'name' => 'TEST321',
            'category' => 'test',], [], ['picture' => $file], []);

并且存储图像如何模拟文件系统?

这也没有通过 laravel mime 验证mimes:jpeg,bmp,png......有人知道如何解决它吗?

4

2 回答 2

0

laravel 允许你通过调用 'shouldReceive' 模拟方法来模拟任何外观:

 File::shouldReceive('move')
        ->with('arguments');

有关更多信息,请参阅文档

于 2016-08-04T05:18:49.850 回答
0

我编写并使用了 Laravel 5.4 包https://packagist.org/packages/stechstudio/laravel-vfs-adapter让我轻松切换到虚拟文件系统适配器。

于 2017-03-01T16:15:55.810 回答