Skip to content

intellipharm-pty-ltd/docker-php-xdebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Docker PHP xDebug

PHP with xDebug (for running PHPUnit) for DockerHub.

Getting Started

This repo contains at least one branch used to auto-build docker images on DockerHub.

  • 5.6 -> Builds image intellipharm/php-xdebug:5.6
  • 7.0 -> Builds image intellipharm/php-xdebug:7.0
  • 7.1 -> Builds image intellipharm/php-xdebug:7.1
  • 7.2 -> Builds image intellipharm/php-xdebug:7.2
  • 7.3 -> Builds image intellipharm/php-xdebug:7.3
  • 7.4 -> Builds image intellipharm/php-xdebug:7.4
  • 8.0 -> Builds image intellipharm/php-xdebug:8.0

Usage

Build the xdebug container by switching to the correct branch, then build and tag based on the current branch

docker build -t intellipharm/php-xdebug:${BRANCH} .

Run PHPUnit

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit

Run PHPUnit with a different version of PHP

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:5.6 \
./vendor/bin/phpunit

Run PHPUnit with specific test suites

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit \
--testsuite "Functional,Unit"

Run PHPUnit with XML log

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit \
--log-junit storage/tests/phpunit-junit.xml

Run PHPUnit and generate Code Coverage Report

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit \
--coverage-html storage/tests/coverage/html \
--coverage-clover storage/tests/coverage/phpunit-clover.xml

Run PHPUnit with specific test suites and generate Code Coverage Report

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit \
--testsuite "Functional,Unit" \
--coverage-html storage/tests/coverage/html \
--coverage-clover storage/tests/coverage/phpunit-clover.xml

Run PHPUnit with specific test suites and generate Code Coverage Report with XML log

docker run --rm \
-v ${DIR}/api:/app \
-w /app intellipharm/php-xdebug:7.4 \
./vendor/bin/phpunit \
--testsuite "Functional,Unit" \
--coverage-html storage/tests/coverage/html \
--coverage-clover storage/tests/coverage/phpunit-clover.xml \
--log-junit storage/tests/phpunit-junit.xml

Access the bash shell

docker run -it intellipharm/php-xdebug:7.4 bash

Access the sh shell

docker run -it intellipharm/php-xdebug:7.4 sh