Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation does not cover setup of testing database #1755

Open
RobQuistNL opened this issue May 9, 2023 · 1 comment
Open

Documentation does not cover setup of testing database #1755

RobQuistNL opened this issue May 9, 2023 · 1 comment

Comments

@RobQuistNL
Copy link

When we follow the docs nothing states anything about provisioning a testing database.

The phpunit environment will try to use app_test because of the doctrine line dbname_suffix: '_test%env(default::TEST_TOKEN)%' in config/packages/doctrine.yaml

I'm not sure if running docker compose exec php bin/console hautelook:fixtures:load as per the documentation uses this too.

Either way, when we run tests following this documentation: https://api-platform.com/docs/distribution/testing/#writing-functional-tests

the first error we run into is:

$ docker compose exec php php ./vendor/bin/phpunit
Could not open input file: ./vendor/bin/phpunit

When we change that to docker compose exec php php ./vendor/bin/simple-phpunit it runs, but, when we follow the docs on https://api-platform.com/docs/core/testing/#the-test-httpclient with the JWT setup, the first error we run into is the following:

There was 1 error:

1) App\Tests\AuthenticationTest::testLogin
Doctrine\DBAL\Exception\ConnectionException: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "database" (172.18.0.5), port 5432 failed: FATAL:  database "app_test" does not exist

This is not covered by the documentation (and preferably this would be included somewhere in the config / phpunit steps)

@soyuka
Copy link
Member

soyuka commented May 10, 2023

we're currently reviewing the documentation for this, thanks for the report @Romaixn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants