Skip to content
Docker container for running PHP tests locally
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
php5.6
php7.0
php7.1
LICENSE
README.md

README.md

PHP Test Runner

A phpunit + xdebug container.

Supported tags and respective Dockerfile links

What does it come with?

  • phpunit
  • xdebug
  • composer
  • bash
  • sed
  • git
  • subversion
  • mysql-client

How to use this image

Using it with docker run

Run phpunit tests

$ docker run -v $(pwd):/var/www/html --rm bostonuniversity/php-test-runner

Get phpunit version

$ docker run -v $(pwd):/var/www/html --rm bostonuniversity/php-test-runner phpunit --version

Open shell in container

$ docker run -v $(pwd):/var/www/html --rm -it bostonuniversity/php-test-runner bash

Using it with docker-compose run

Example docker-compose.yml file:

version: "3.7"
services:
  php-app:
    build: .
    volumes:
      - .:/var/www/html

  php-test-runner:
    image: bostonuniversity/php-test-runner
    volumes:
      - .:/var/www/html

To execute the tests, run docker-compose run --rm php-test-runner.

Xdebug - Remote Debugging

Xdebug is configured with the following settings:

  • xdebug.remote_enable=1
  • xdebug.remote_autostart=1
  • xdebug.remote_host="host.docker.internal"
  • xdebug.remote_port="9000"
  • xdebug.remote_log="/var/log/xdebug.log"

You can set/override any setting by providing a XDEBUG_CONFIG environment variable like so:

$ docker run -e XDEBUG_CONFIG="remote_host=192.168.65.2 remote_port=8999" -v $(pwd):/var/www/html --rm bostonuniversity/php-test-runner

Note: As of August 2018 host.docker.internal will work with Docker for Mac and Docker for Windows. However, it still does not seem to be supported on Docker for Linux. See this github issue for more information regarding linux: https://github.com/docker/for-linux/issues/264

License

This project is licensed under the MIT License - see the LICENSE file for details.

You can’t perform that action at this time.