PHPUnit in Docker Extension for VS Code
This extension was developed with the assistance of AI tools.
Run PHPUnit tests inside Docker containers directly from VS Code's Test Explorer UI.

Features
- 🐳 Execute PHPUnit tests in Docker containers
- 🔍 Automatic test discovery based on file patterns
- ▶️ Run tests at multiple levels (file, class, method)
- 🐛 Debug support with Xdebug integration
- 📋 Rich error reporting with source locations
- 📂 Configurable container paths and PHPUnit locations
Installation
- Install the extension from VS Code Marketplace
- Ensure your Docker container is running with your PHP project mounted
- Configure the extension settings (see below)
Configuration
Open VS Code settings (Ctrl+,) and configure under "PHPUnit in Docker":
phpunitDocker.containerName : Required
Your Docker container name (e.g. my-php-container )
phpunitDocker.containerPath : Path inside container where project is mounted
(Default: /var/www/app )
phpunitDocker.phpunitPath : Path to PHPUnit executable
(Default: vendor/bin/phpunit )
phpunitDocker.testFilePattern : Glob pattern for test files
(Default: **/*Test.php )
Usage
- Open the Test Explorer (View → Testing)
- Tests will automatically discover from your project
- Use the run/debug icons next to:
- Individual test methods
- Test classes
- Entire test files
Debugging Tests
- Ensure Xdebug is configured in your Docker container
- Set breakpoints in your test files
- Use the "Debug" profile from the Test Explorer
- VS Code will automatically attach to the debugger
| |