PHPUnit Docker Container.
- PHP 7.0
Installation / Usage
Install the phpunit/phpunit container:
$ docker pull phpunit/phpunit
Create a phpunit.xml defining your tests suites.
Run PHPUnit through the PHPUnit container:
$ docker run -v $(pwd):/app --rm phpunit/phpunit run
or in shorthand add
$ sudo sh -c "printf \"#!/bin/sh export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin docker run -v $(pwd):/app --rm phpunit/phpunit run \\\$@ \" > /usr/local/bin/phpunit" $ sudo chmod +x /usr/local/bin/phpunit
and then from host machine just
$ phpunit --version
To run, test and develop the PHPUnit Dockerfile itself, you must use the source directly:
Download the source:
$ git clone https://github.com/JulienBreux/phpunit-docker.git
Switch to the phpunit-docker directory:
$ cd phpunit-docker
Build the container:
$ docker build -t phpunit/phpunit .
Test running the container:
$ docker run phpunit/phpunit --help
How to generate?
Install associate GEMs
$ gem install bundle $ bundle
Generate a new version
version=6.0.6 rake version:add
Remove a version
An error in your generation?
version=6.0.6 rake version:remove
First of all: nice work.
I am trying not to seem offensive: is this approved or supported officially from PHPUnit in any ways, or you just registered the orga on docker hub? Same for phpsec?
Ran my tests recently pulling 'latest' and got 'No code coverage driver is available' - which suggests some kind of xdebug problem. I tried with version 5.1.0 and that seems to work for me.
@julienbreux php7-session :)
While using pdo connection in test file.I am getting PDOException: SQLSTATE[HY000]  Unknown MySQL server host 'mysql' (-2). I have PDO enabled and mysql server host is "mysql". And I am using command " docker run -v $(pwd):/app/tests --rm phpunit/phpunit /app/tests " to run the tests
@vesela Do you have more info?
@antoniog85, and thanks for your constructive feedback... (the Hub does not notify me)
@antoniog85, hi, PHP7 is now supported!
I can see that 4 months ago has been asked for the support php7, but I still can't fetch any new tag...
docker run phpunit/phpunit "some test" didnt work for me
@julienbreux I think you have to add the 5.1 tag in order to support php7, don't you?