diff --git a/src/Illuminate/Http/Testing/File.php b/src/Illuminate/Http/Testing/File.php index 37d41ea23b99..01c118f12bbc 100644 --- a/src/Illuminate/Http/Testing/File.php +++ b/src/Illuminate/Http/Testing/File.php @@ -45,6 +45,31 @@ public function __construct($name, $tempFile) ); } + /** + * Create a new fake file. + * + * @param string $name + * @param int $kilobytes + * @return \Illuminate\Http\Testing\File + */ + public static function create($name, $kilobytes = 0) + { + return (new FileFactory)->create($name, $kilobytes); + } + + /** + * Create a new fake image. + * + * @param string $name + * @param int $width + * @param int $height + * @return \Illuminate\Http\Testing\File + */ + public static function image($name, $width = 10, $height = 10) + { + return (new FileFactory)->image($name, $width, $height); + } + /** * Set the "size" of the file in kilobytes. * diff --git a/src/Illuminate/Http/Testing/FileFactory.php b/src/Illuminate/Http/Testing/FileFactory.php index 1375773bff90..41548ef58e5d 100644 --- a/src/Illuminate/Http/Testing/FileFactory.php +++ b/src/Illuminate/Http/Testing/FileFactory.php @@ -11,7 +11,7 @@ class FileFactory * @param int $kilobytes * @return \Illuminate\Http\Testing\File */ - public function create($name, $kilobytes) + public function create($name, $kilobytes = 0) { return tap(new File($name, tmpfile()), function ($file) use ($kilobytes) { $file->sizeToReport = $kilobytes * 1024; @@ -22,7 +22,7 @@ public function create($name, $kilobytes) * Create a new fake image. * * @param string $name - * @param int $height + * @param int $width * @param int $height * @return \Illuminate\Http\Testing\File */