Add a Docker configuration - #30
Conversation
This change adds the initial Docker setup, providing an environment where the tests can be run, regardless of the user's operating system. It provides three services; one for PHP, one for MySQL, and one for PostgreSQL. The PHP environment has all of the dependencies and extensions required to interact with MySQL, PostgreSQL, and SQLite, along with any required binaries. It also updates PHPUnit's configuration, where required, to sync with that configuration. The change also removes the Vagrantfile as it's no longer required. Signed-off-by: Matthew Setter <matthew@matthewsetter.com>
0ce7bef to
c806991
Compare
This removes the Composer setup from the startup script, replacing it with mounting the files from the local filesystem as volume mounts. It also exposes the database ports so that they can be connected to locally, should the need arise, using database clients. It adds health checks to help ensure a robust service configuration. And, it loads SQL scripts to initialise the MySQL and PostgreSQL databases. Signed-off-by: Matthew Setter <matthew@matthewsetter.com>
f60e2bf to
f15189d
Compare
|
I've not run the unit tests yet, but of the integration tests, I get the following results: Tests: 22, Assertions: 0, Errors: 3, Warnings: 2, PHPUnit Deprecations: 15, Skipped: 22. |
|
For the unit tests ( docker compose exec php composer check
> phpcs
.........EE..........E.........................E............ 60 / 381 (16%)
....................E.......E................E.....E........ 120 / 381 (31%)
.........E.........E..E..........E...E.........EE..E........ 180 / 381 (47%)
E..........E....E....E..E................................... 240 / 381 (63%)
............................................................ 300 / 381 (79%)
............................................................ 360 / 381 (94%)
....
Fatal error: Trait "PHPUnit\Framework\TestListenerDefaultImplementation" not found in /var/www/html/test/integration/IntegrationTestListener.php on line 17 |
tyrsson
left a comment
There was a problem hiding this comment.
Looks really good, now to just migrate it once the satellites are ready. Should be simple enough to split. Then its a matter of updating the test :(
| ``` | ||
|
|
||
| If you see three containers listed, then they're all running, and you are ready to run the test suite. | ||
| So, copy `phpunit.xml.dist` to `phpunit.xml`, and change the following environment variable to "true" to enable the three databases: |
There was a problem hiding this comment.
Is this line suppose to remain in docs?
There was a problem hiding this comment.
Line 71 is the line I was referencing there.
There was a problem hiding this comment.
line 23 is most likely why you are getting the listener error.
There was a problem hiding this comment.
Although, I'm not sure why unless this was affected by the huge amount of changes to the event system in the newer versions of Phpunit.
This PR adds a Docker (Compose) setup and deprecates the Vagrantfile as it's no longer required.
The configuration provides an environment where the tests can be run, regardless of the user's operating system. The Compose configuration provides three services; one for PHP, one for MySQL, and one for PostgreSQL. The PHP environment has all of the dependencies and extensions required to interact with MySQL, PostgreSQL, and SQLite, along with any required binaries. It also updates PHPUnit's configuration, where required, to sync with that configuration. The change also updates README.md to reflect the changes.