├── README.rst ├── example ├── .gitignore ├── composer.json ├── docker-compose.yml ├── phpunit.xml └── tests │ └── ExampleTest.php ├── hhvm └── Dockerfile ├── php5.4 └── Dockerfile ├── php5.5 └── Dockerfile └── php5.6 └── Dockerfile /README.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | Docker Multi PHPUnit 3 | =============================== 4 | 5 | Test your PHP code in multiple versions using Docker. 6 | 7 | * Free software: Apache 2.0 license 8 | 9 | Features 10 | -------- 11 | 12 | * Supports PHPUnit tests on PHP 5.4, 5.5, 5.6 and HHVM. 13 | 14 | Pre-requisites 15 | -------------- 16 | 17 | * Docker Toolbox: https://docs.docker.com/toolbox/overview/ 18 | * PHP Composer: https://getcomposer.org/ 19 | 20 | Usage Example 21 | --------------------- 22 | 23 | Sample app in the ``example`` folder. 24 | 25 | .. code:: bash 26 | 27 | cd example 28 | 29 | # Run the unit tests in different versions: 30 | 31 | composer update 32 | 33 | docker-compose run php54 phpunit 34 | 35 | docker-compose run php55 phpunit 36 | 37 | docker-compose run php56 phpunit 38 | 39 | docker-compose run hhvm phpunit 40 | 41 | 42 | Also, see ``example/docker-compose.yml``. -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | *.lock 3 | /.idea 4 | logs -------------------------------------------------------------------------------- /example/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DockerMultiPHP/Example", 3 | "description": "Example Test", 4 | "license": "MIT", 5 | "keywords": ["docker", "multi", "php", "versions"], 6 | "authors": [ 7 | { 8 | "name": "Ardy Dedase", 9 | "email": "ardy.dedase@gmail.com" 10 | } 11 | ], 12 | "require-dev": { 13 | "phpunit/phpunit": "4.6.*" 14 | } 15 | } -------------------------------------------------------------------------------- /example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | php54: 2 | image: ardydedase/phpunit-php54 3 | volumes: 4 | - .:/app 5 | working_dir: /app 6 | php55: 7 | image: ardydedase/phpunit-php55 8 | volumes: 9 | - .:/app 10 | working_dir: /app 11 | php56: 12 | image: ardydedase/phpunit-php56 13 | volumes: 14 | - .:/app 15 | working_dir: /app 16 | hhvm: 17 | image: ardydedase/phpunit-hhvm 18 | volumes: 19 | - .:/app 20 | working_dir: /app 21 | -------------------------------------------------------------------------------- /example/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 18 | 19 | 20 | ./tests 21 | 22 | 23 | -------------------------------------------------------------------------------- /example/tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | greeting = "Hello"; 10 | } 11 | 12 | public function testEcho() 13 | { 14 | echo $this->greeting; 15 | } 16 | } -------------------------------------------------------------------------------- /hhvm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM estebanmatias92/hhvm:3.8-cli 2 | 3 | # install composer 4 | RUN curl -sS https://getcomposer.org/installer | php 5 | RUN mv composer.phar /usr/local/bin/composer 6 | 7 | # Install git 8 | RUN apt-get update 9 | RUN apt-get install -y git 10 | 11 | # Goto temporary directory. 12 | WORKDIR /tmp 13 | 14 | # Run composer and phpunit installation. 15 | RUN composer selfupdate && \ 16 | composer require "phpunit/phpunit:~4.6.10" && \ 17 | ln -s /tmp/vendor/bin/phpunit /usr/local/bin/phpunit 18 | 19 | # Set up the application directory. 20 | VOLUME ["/app"] 21 | WORKDIR /app 22 | 23 | # Set up the command arguments. 24 | # ENTRYPOINT ["/usr/local/bin/phpunit"] 25 | # CMD ["--help"] -------------------------------------------------------------------------------- /php5.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.4-cli 2 | 3 | # install composer 4 | RUN curl -sS https://getcomposer.org/installer | php 5 | RUN mv composer.phar /usr/local/bin/composer 6 | 7 | # Install git 8 | RUN apt-get update 9 | RUN apt-get install -y git 10 | 11 | # Goto temporary directory. 12 | WORKDIR /tmp 13 | 14 | # Run composer and phpunit installation. 15 | RUN composer selfupdate && \ 16 | composer require "phpunit/phpunit:~4.6.10" && \ 17 | ln -s /tmp/vendor/bin/phpunit /usr/local/bin/phpunit 18 | 19 | # Set up the application directory. 20 | VOLUME ["/app"] 21 | WORKDIR /app 22 | 23 | # Set up the command arguments. 24 | # ENTRYPOINT ["/usr/local/bin/phpunit"] 25 | # CMD ["--help"] -------------------------------------------------------------------------------- /php5.5/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.5-cli 2 | 3 | # install composer 4 | RUN curl -sS https://getcomposer.org/installer | php 5 | RUN mv composer.phar /usr/local/bin/composer 6 | 7 | # Install git 8 | RUN apt-get update 9 | RUN apt-get install -y git 10 | 11 | # Goto temporary directory. 12 | WORKDIR /tmp 13 | 14 | # Run composer and phpunit installation. 15 | RUN composer selfupdate && \ 16 | composer require "phpunit/phpunit:~4.6.10" && \ 17 | ln -s /tmp/vendor/bin/phpunit /usr/local/bin/phpunit 18 | 19 | # Set up the application directory. 20 | VOLUME ["/app"] 21 | WORKDIR /app 22 | 23 | # Set up the command arguments. 24 | # ENTRYPOINT ["/usr/local/bin/phpunit"] 25 | # CMD ["--help"] -------------------------------------------------------------------------------- /php5.6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:5.6-cli 2 | 3 | # install composer 4 | RUN curl -sS https://getcomposer.org/installer | php 5 | RUN mv composer.phar /usr/local/bin/composer 6 | 7 | # Install git 8 | RUN apt-get update 9 | RUN apt-get install -y git 10 | 11 | # Goto temporary directory. 12 | WORKDIR /tmp 13 | 14 | # Run composer and phpunit installation. 15 | RUN composer selfupdate && \ 16 | composer require "phpunit/phpunit:~4.6.10" && \ 17 | ln -s /tmp/vendor/bin/phpunit /usr/local/bin/phpunit 18 | 19 | # Set up the application directory. 20 | VOLUME ["/app"] 21 | WORKDIR /app 22 | 23 | # Set up the command arguments. 24 | # ENTRYPOINT ["/usr/local/bin/phpunit"] 25 | # CMD ["--help"] --------------------------------------------------------------------------------