Skip to content

Documentation does not cover setup of testing database #1755

Open
@RobQuistNL

Description

@RobQuistNL

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions