[RFC] Use Docker for unit testing

The repository https://github.com/laminas-api-tools/api-tools-doctrine-querybuilder requires Mongo be installed on the developer’s computer in order to run unit tests. I propose Docker be used to build an image with a variable PHP version and options (such as xdebug) which includes required services.

Working Examples

The project https://github.com/team-telnyx/telnyx-php approached me with a problem which I solved using Docker for all unit testing. This is documented in the repository. Please read Development in the README.md to start.

The project https://github.com/doctrine/DoctrineMongoODMModule which I maintain has been updated to use Docker for the same reasons it would be done on api-tools-doctrine-querybuilder. This example is the closest to how I want to implement Docker on this repository.

RFC

I have a change to make to api-tools-doctrine-querybuilder and I can’t do that without first taking this step. If you have experience using Docker for unit testing I look forward to your comments.

Consider that most of this is likely not required if we move to github actions (slowly, but steadily happening :slight_smile: )

That’s good news, @ocramius. The issue for this RFC is https://github.com/laminas-api-tools/api-tools-doctrine-querybuilder/issues/8 which lists two possible stages and if Travis CI is not a target then the 2nd stage can be safely discarded. The first stage is

Change running of phpunit to use a docker image. Maintain Travis CI testing as-is.

and this is what I’d like this RFC to concentrate on now.