PHPunit tests and Artisan Dusk tests both use APP_URL
from .env File.
But there is something strange, maybe because of my setup but I do not know, it insane.
I have Xampp, my project is on localhost/forum/
When I have
APP_URL=http://localhost
My unit tests are OK.
e.g.
$response = $this->get('sekcja/sadsadsadsadas');
$response->assertStatus(200);
All good.
Like laravel knows it is http://localhost
but tests on http://localhost/forum/
because there is this project and looks on http://localhost/forum/sekcja/sadsadsadsadas
But...
Dusk see this wrong.
Dusk is loading me localhost where is welcome XAMPP's Page.
Not my project page at localhost/forum/
Then I change in ENV to APP_URL=http://localhost/forum/
And works good, dusk test are good...
But then, you know what?
My PHPunit tests aren't good, they doesn't work anymore.
They can't find this $this->get('sekcja/sadsadsadsadas');
anymore.
So my question is
What is happening here? In documentation I read for dusk i have to set this as I have set, but them my PHPunit test are broken. Why? if both phpunit and dusk test are using the same variable why they want different value for it? That's kinda silly.
php artisan serve
or something like that? That would be different than using XAMPP and might be the cause of your issue, i've never used XAMPP, i've only used Homestead but perhaps that is the cause of the issue. – JonnySerra