docker-php
docker-php copied to clipboard
Add tests
Summary
- It would be helpful to add tests
Order
It would be nice to have each image go through these steps:
- Setup (Pull base images & login to Docker)
- Build
- Test
- Push
What needs to be figured out yet
- What is the best way to "test" that PHP is working?
- Will it change on each deployment type (CLI, FPM, FPM-NGINX)
Helpful resources
Here's some code that was provided by Github for reference:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
fi
Push image to GitHub Packages.
See also https://docs.docker.com/docker-hub/builds/
What is the best way to "test" that PHP is working?
I would think just PHP commands would be sufficient, e.g. php -v
, php -i
, etc. They'll also let you assert that extensions are installed.
Awesome! Thanks for the insight @AkenRoberts!
I would think just PHP commands would be sufficient, e.g.
php -v
,php -i
, etc.
That is like assuming an SQL server is okay by querying its version. Real life functional tests reveal real life problems.
Right. Maybe more functional tests to ensure PHP is behaving would be useful for a container providing it. I don't see that immediately ('certainly PHP itself is well-tested'), but admittedly that could be naive.
Definitely choose the level of testing that ensures the value provided to end users is maintained. 👍🏼