Docker container to install and run PHPUnit.
This container assumes all dependencies (including PHPUnit) are defined in a composer.json file in your project. The phpunit executable should be installed in vendor/bin in the application directory.
-
Install the opennemas/phpunit container:
$ docker pull opennemas/phpunit
-
Create a phpunit.xml defining your tests suites.
...
-
Run PHPUnit through the PHPUnit container:
$ docker run -v $(pwd):/app --rm opennemas/phpunit runor 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 opennemas/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/openhost/opennemas-phpunit.git
-
Switch to the opennemas-phpunit directory:
$ cd opennemas-phpunit -
Build the container:
$ docker build -t opennemas/phpunit . -
Test running the container:
$ docker run opennemas/phpunit --help