farshadf's avatar

laravel parallel test cant create the database

i am trying to run laravel feature tests in parallel mode as it is in document . my phpunit.xml is configed as below :

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
        <env name="MAIL_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="mysql"/>
    </php>

and i am running the tests with this command :

php artisan test --parallel

the result is all tests fail with this error message :

PDOException: SQLSTATE[HY000] [1049] Unknown database 'mydbname_test_11'

should i create this database before starting test or laravel creates that automatically ?

0 likes
2 replies
Sinnbeck's avatar

Laravel should try to create it automatically, but be aware that it requires that the sql user has rights to create new databases

1 like
farshadf's avatar

@Sinnbeck right . i have changed the user in my config to the root mysql but still the same error :

DB_USERNAME=root
DB_PASSWORD=secret

i changed that both in .env and .env.testing

Please or to participate in this conversation.