UploadedFile::fake()->image('test.jpg', 100, 100) ]; $content = $this->post('api/upload/uploadImage', $data); $content = json_decode($content, true); $this->assertTrue($content['Status'] == 1); $this->assertDatabaseHas('tz_file_pic', [ 'title' => 'test.jpg', 'file' => $content['file'] ]); $this->assertFileExists($this->laraPath() . '/../www/Uploads/' . $content['file']); } }