Composer test does not work as expeceted
-
Hi
Composer test command does not work in a standard installation and there is no documentation stating how to set up the testing
e.g
composer test fails with this:set -e
@php artisan migrate:fresh --env=testingDropping all tables .................................................................................................................... 10ms FAIL
In Connection.php line 759:
SQLSTATE[HY000] [2002] Connection refused (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')
In Exception.php line 18:
SQLSTATE[HY000] [2002] Connection refused
In PDOConnection.php line 40:
SQLSTATE[HY000] [2002] Connection refused
Normally testing uses SQlite not the same connection
does one have to have a special .env or how can I make testing work ?
Kind regards
Steen -
@rabol said in Composer test does not work as expeceted:
Connection refused
Hi there,
Please check your .env file, i guess you are not configure your databse credentials -
@sanjay-webkul but normally one does not need to create a connection.
Test should run using a separate databasehttps://laravel.com/docs/9.x/testing
when you specify --env=testing there NEED to be a .env file named .env.testing
Maybe a note in the documentation
even with a .env.testing and using SQLite (Which I think is quite normal) it does not work
-
Hi there,
But the databse should be created which in mentioned on your .env.test file.