PHPUnit Runner is a VS Code extension for discovering and running PHPUnit tests directly from the editor and the Testing view.
It parses PHPUnit test files, organizes them by folder structure, and lets you run the current file, the test at the cursor, or discovered tests from the VS Code test explorer.
- Discovers PHPUnit test files across the workspace
- Detects test methods by:
test*method names@testdocblocks#[Test]attributes
- Organizes tests in the Testing panel by workspace, folders, files, classes, and methods
- Run the current file from the editor title
- Run the test at the current cursor position
- Shows PHPUnit output in a dedicated output channel
- Supports local execution and Docker container execution
Install from the VS Code Marketplace.
Core settings:
phpunitRunner.phpExecutablephpunitRunner.phpunitCommandphpunitRunner.configurationFilephpunitRunner.workingDirectoryphpunitRunner.additionalArgsphpunitRunner.testFileGlobs
Docker settings:
phpunitRunner.docker.enablephpunitRunner.docker.commandphpunitRunner.docker.containerphpunitRunner.docker.workspacePathphpunitRunner.docker.execArgs
{
"phpunitRunner.phpunitCommand": "vendor/bin/phpunit",
"phpunitRunner.configurationFile": "phpunit.xml"
}{
"phpunitRunner.docker.enable": true,
"phpunitRunner.docker.container": "app",
"phpunitRunner.docker.workspacePath": "/var/www/html",
"phpunitRunner.phpunitCommand": "vendor/bin/phpunit"
}PHPUnit Runner: Refresh TestsPHPUnit Runner: Run Current FilePHPUnit Runner: Run Test At CursorPHPUnit Runner: Show Output
- Source: https://github.com/ayanozturk/vscode-phpunit-runner
- License: MIT