Hi, looks like it does use phpunit.xml
if (!file_exists($file = base_path('phpunit.xml'))) {
$file = base_path('phpunit.xml.dist');
}
return array_merge(['-c', $file], $options);
Hi folks,
Just wondering if anyone know if using php artisan test actually uses the phpunit.xml file or a .env.testing file at all please?
Regards,
Hi, looks like it does use phpunit.xml
if (!file_exists($file = base_path('phpunit.xml'))) {
$file = base_path('phpunit.xml.dist');
}
return array_merge(['-c', $file], $options);
Thanks @sergiu17, indeed it looks like it does but it doesn't seem to take note of my Database settings in here :/
What isnt working? A specific model that uses the wrong connection ? Be aware that if you have set it manually on the model, it ignores phpunit.xml/env
Hi @sinnbeck ,
So i have set:
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
When running phpunit natively /vendor/bin/phpunit then these variables are picked up. When i run php artisan test, it isn't I can see it's reading from my .env file?
What env file? .env.testing ? Or the normal .env file?
It seems to load both .env.testing and phpunit.xml :)
The above variables are set in the phpunit.xml file as per the docs
The testing environment variables may be configured in the phpunit.xml file, but
it isn't I can see it's reading from my .env file?
And I asked
What env file?
Sorry, I can see it is reading from .env
No worries. Ok so you dont have a .env.testing file? :) If so it will also use this file.
Nope, no .env.testing file at all, I just figured I could use the phpunit.xml rather than having another .env file laying around. Like I said, PHPUnit itself picks up the database config but php artisan test just defaults to the .env which I found a little weird.
so whats the point of the .env.test file? is it used ANYWHERE anymore?
Please or to participate in this conversation.