Skip to content

Add a Docker configuration - #30

Merged
tyrsson merged 2 commits into
3.0.xfrom
add-docker-configuration
Mar 20, 2025
Merged

Add a Docker configuration#30
tyrsson merged 2 commits into
3.0.xfrom
add-docker-configuration

Conversation

@settermjd

Copy link
Copy Markdown
Collaborator

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.

@settermjd settermjd added the enhancement New feature or request label Mar 19, 2025
@settermjd settermjd added this to the 3.0.0 milestone Mar 19, 2025
@settermjd settermjd self-assigned this Mar 19, 2025
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>
@settermjd
settermjd force-pushed the add-docker-configuration branch from 0ce7bef to c806991 Compare March 19, 2025 06:18
@settermjd
settermjd marked this pull request as draft March 19, 2025 06:51
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>
@settermjd
settermjd force-pushed the add-docker-configuration branch from f60e2bf to f15189d Compare March 19, 2025 07:04
@settermjd
settermjd marked this pull request as ready for review March 19, 2025 07:07
This was referenced Mar 19, 2025
@settermjd

Copy link
Copy Markdown
Collaborator Author

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.

@settermjd

Copy link
Copy Markdown
Collaborator Author

For the unit tests (composer check) I get the following results:

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

@simon-mundy simon-mundy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in @laminas-db Mar 19, 2025

@tyrsson tyrsson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :(

Comment thread README.md
```

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line suppose to remain in docs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 71 is the line I was referencing there.

Comment thread phpunit.xml.dist

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 23 is most likely why you are getting the listener error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tyrsson
tyrsson merged commit 6212fa9 into 3.0.x Mar 20, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in @laminas-db Mar 20, 2025
@tyrsson
tyrsson deleted the add-docker-configuration branch March 28, 2025 04:08
@tyrsson tyrsson modified the milestones: 1.0.0, 0.1.x Sep 5, 2025
@tyrsson tyrsson added this to @phpdb Sep 5, 2025
@github-project-automation github-project-automation Bot moved this to Todo in @phpdb Sep 5, 2025
@tyrsson tyrsson moved this from Todo to Done in @phpdb Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants