Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kirk.Franklin's avatar

UrlGenerator TypeError running php artisan dusk or phpunit

I'm getting this error when I run either php artisan dusk or phpunit:

TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in RoutingServiceProvider.php

A lot of suggestions for fixing this say to remove any instances of asset( or url( from config files. I'm not using either of those in any config file.

php artisan and php artisan route:list run fine.

0 likes
3 replies
Kirk.Franklin's avatar

I removed all third-party config files and updated the Laravel config files to match the ones from the latest install and I'm still getting this error.

Jadon's avatar

@kirk.franklin Did you find a solution for this? I'm experiencing the same problem after attempting to upgrade an application from 5.7 to 5.8. I'm also not using any url helpers in the config files.

Please or to participate in this conversation.