phpunit4docker is a bunch of stand-alone Docker containers, based on the principle of single logical services per container. These containers can be used from IDEs, like Visual Studio Code and PHPStorm, giving you the ability to experiment with different versions and not rely on the PHPUnit version that exists under the .vendors folder inside your project.
All the docker images are based on Alpine Linux and have a really small footprint, requiring less than 45MB of space.
All images are built for AMD64 and ARM64 platforms, so they can be used in any Intel/AMD CPU based computers, in Mac M1 and other ARM CPU based computers.
phpunit12: php8.5-phpunit12, php8.4-phpunit12, php8.3-phpunit12
phpunit11: php8.5-phpunit11, php8.4-phpunit11, php8.3-phpunit11, php8.2-phpunit11
phpunit10: php8.5-phpunit10, php8.4-phpunit10, php8.3-phpunit10, php8.2-phpunit10, php8.1-phpunit10
phpunit9: php8.5-phpunit9, php8.4-phpunit9, php8.3-phpunit9, php8.2-phpunit9, php8.1-phpunit9, php8.0-phpunit9, php7.4-phpunit9, php7.3-phpunit9
phpunit8: php8.5-phpunit8, php8.4-phpunit8, php8.3-phpunit8, php8.2-phpunit8, php8.1-phpunit8, php8.0-phpunit8, php7.4-phpunit8, php7.3-phpunit8, php7.2-phpunit8
phpunit7: php7.3-phpunit7, php7.2-phpunit7, php7.1-phpunit7
phpunit6: php7.2-phpunit6, php7.1-phpunit6
phpunit5: php7.1-phpunit5, php5.6-phpunit5
Aligned release based on PHPUnit Supported Versions
All the images have xDebug installed, aligned with the Supported Versions.
Find the latest tags at Docker Hub
To use these images at your docker-compose yml files, you have to add the following under services:
phpunit:
image: walkero/phpunit-alpine:php7.3-phpunit8
container_name: "projectname_phpunit"
environment:
XDEBUG_MODE: 'coverage'
volumes:
- ./public_html:/var/www/html
I recommend using the Better PHPUnit extension.
Add the following settings in your project settings.json file.
{
"better-phpunit.docker.enable": true,
"better-phpunit.docker.command": "docker exec -it <container name>",
"better-phpunit.docker.paths": {
"<your local public_html files path>": "/var/www/html"
},
"better-phpunit.phpunitBinary": "phpunit",
"better-phpunit.xmlConfigFilepath": "/var/www/html/phpunit.xml",
"better-phpunit.coveragePath": "test/coverage",
"better-phpunit.coverageFormat": "HTML",
}
Consult the extension's documentation about the key combinations or the menu selections you can use to run your tests.
Preferences -> Build, Execution, Deployment -> DockerDocker for MacTCP socket. Set the Engine API URL to:
unix:///var/run/docker.sockhttp://127.0.0.1:2376 or tcp://localhost:2376Preferences -> Languages & Frameworks -> PHPFrom Docker, Vagrant, VM, Remote...Docker Compose with the following values:
OK buttonConnect to the existing container ('docker-compose exec') as these containers run alwaysOK buttonPreferences -> Languages & Frameworks -> PHP -> Test FrameworksPHPUnit by Remote interpreter...Path mappingsUse Composer Autoloader and set the Path to script to your vendor autoload.php file in the container, i.e. /var/www/html/vendor/autoload.php/var/www/html/phpunit.xml.distContent type
Image
Digest
sha256:b0293c36e…
Size
40.2 MB
Last updated
6 months ago
docker pull walkero/phpunit-alpine:php8.5-phpunit8