I'm trying to figure out why when I run my CI Build it says that my connection to the database times out. My database is created because my migrations run completely but when it gets to my test suite then it loses connection.
The command "php artisan key:generate" exited with 0. 31.27s$ vendor/bin/phpunit PHPUnit Pretty Result Printer 0.19.14 by Codedungeon and contributors. ==> Configuration:~/build/me/app/vendor/codedungeon/phpunit-result-printer/phpunit-printer.yml PHPUnit 7.3.5 by Sebastian Bergmann and contributors. ==> Tests\Feature\Module\MyTest⚈ Time: 31.12 seconds, Memory: 24.00MB There was 1 error: 1) Tests\Feature\Module\Test::my_test_method Illuminate\Database\QueryException: SQLSTATE[HY000]  Connection timed out (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE') Caused by Doctrine\DBAL\Driver\PDOException: SQLSTATE[HY000]  Connection timed out
APP_ENV=testing APP_KEY= APP_DEBUG=true DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=my_database_name DB_USERNAME=root DB_PASSWORD= CACHE_DRIVER=array SESSION_DRIVER=array QUEUE_DRIVER=sync
language: php php: - 7.1 services: - mysql before_script: - cp .env.travis .env - mysql -e 'CREATE DATABASE my_database_name;' - composer self-update - composer install --no-interaction - php artisan key:generate - php artisan migrate script: - vendor/bin/phpunit cache: directories: - vendor
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.