I’m a beginner in Laravel and still learning, when I wanted to do a fake file upload test I got an error
public function testUpload()
{
$picture = UploadedFile::fake()->image('blabla.png');
$this->post('/file/upload',[
'picture' => $picture
])->assertSeeText("OK blabla.png");
}
Error: Call to undefined function
IlluminateHttpTestingimagecreatetruecolor()
in the learning video that I saw, a blabla.png file appeared in the folder storage
2
Answers
Try using valid import
https://laravel.com/docs/10.x/http-tests#testing-file-uploads
I assume it’s about the PHP GD library not related to Laravel or the code. The code seems OK to me
Install PHP GD Library and try