# \[RFC\] Use Docker for unit testing

**URL:** <https://discourse.laminas.dev/t/rfc-use-docker-for-unit-testing/1774>\
**Category:** Contributors\
**Created:** [August 8, 2020, 3:21am UTC](https://discourse.laminas.dev/t/rfc-use-docker-for-unit-testing/1774 "2020-08-08T03:21:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomHAnderson](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/tomhanderson/32/150_2.png) [@TomHAnderson](https://discourse.laminas.dev/u/TomHAnderson)\
**Post date:** [August 8, 2020, 3:21am UTC](https://discourse.laminas.dev/t/rfc-use-docker-for-unit-testing/1774/1 "2020-08-08T03:21:30Z")

</div>

The repository [https://github.com/laminas-api-tools/api-tools-doctrine-querybuilder](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](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](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.

---

<div class="post-metadata">

**Author:** ![ocramius](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/ocramius/32/23_2.png) [@ocramius](https://discourse.laminas.dev/u/ocramius)\
**Post date:** [August 8, 2020, 12:27pm UTC](https://discourse.laminas.dev/t/rfc-use-docker-for-unit-testing/1774/2 "2020-08-08T12:27:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TomHAnderson](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/tomhanderson/32/150_2.png) [@TomHAnderson](https://discourse.laminas.dev/u/TomHAnderson)\
**Post date:** [August 9, 2020, 12:45am UTC](https://discourse.laminas.dev/t/rfc-use-docker-for-unit-testing/1774/3 "2020-08-09T00:45:09Z")

</div>

That’s good news, @ocramius. The issue for this RFC is [https://github.com/laminas-api-tools/api-tools-doctrine-querybuilder/issues/8](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

```auto
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.
