That should not work since test files and dusk run separately. Maybe you can get away with contextual binding https://laravel.com/docs/7.x/container#contextual-binding but I do not like to pollute my code with test-related stuff.
Jul 25, 2020
6
Level 1
Laravel Dusk and HTTP::mock()
Hey there, so I'm starting to get into testing my Laravel apps, and I've really enjoyed using the mock functions when dealing with external APIs. Now the app that I'm currently dealing with is all external stuff, there's no local DB currently. Given the nature of this app, and how we're wanting to have this run through a GitHub action when making pull requests, I'm not really wanting to have a .env in git with API keys.
Long story short, is there any way to use HTTP::mock() with Laravel Dusk. I've tried a good handful of things, but nothing has seemed to work.
Thanks!
Level 61
Please or to participate in this conversation.