The VS Code Test Explorer extension for PHPUnit
MIT License
Run your PHPUnit tests in Node using the Test Explorer UI.
Include if your extension adds any VS Code settings through the contributes.configuration
extension point.
This extension contributes the following settings:
phpunit.php
: Absolute path to php. Fallback to global php if it exists on the command line.phpunit.phpunit
: Path to phpunit. Can be the phpunit file or phpunit.phar.\n\nAutomatically finds it in commonphpunit.command
: Custom command to run. Ex: docker exec -t container_name
.phpunit.args
: Any phpunit args (phpunit --help) E.g. --configuration ./phpunit.xml.distphpunit.clearOutputOnRun
: True will clear the output when we run a new test. False will leave the output after everyphpunit.showAfterExecution
Specify if the test report will automatically be shown after executionThe following commands are available in VS Code's command palette, use the ID to add them to your keyboard shortcuts:
phpunit.reload
: PHPUnit: Reload testsphpunit.run-all
: PHPUnit: Run all testsphpunit.run-file
: PHPUnit: Run tests in current filephpunit.run-test-at-cursor
: PHPUnit: Run the test at the current cursor positionphpunit.rerun
: PHPUnit: Repeat the last test run{
"phpunit.php": "php",
"phpunit.phpunit": "vendor/bin/paratest",
"phpunit.args": [
"-c",
"phpunit.xml"
],
"phpunit.paths": {
// ${pwd} (current directory) is mounted to /app
"${workspaceFolder}": "/app",
// ${workspaceFolder} is mapped to /app
},
}
{
"phpunit.command": "docker exec -t [container_id] /bin/sh -c",
"phpunit.php": "php",
"phpunit.phpunit": "vendor/bin/phpunit",
"phpunit.args": [
"-c",
"phpunit.xml"
],
"phpunit.paths": {
// ${pwd} (current directory) is mounted to /app
"${workspaceFolder}": "/app",
// ${workspaceFolder} is mapped to /app
},
}
{
"phpunit.command": "docker run --rm -t -v ${pwd}:/app -w /app php:latest php",
"phpunit.php": "php",
"phpunit.phpunit": "vendor/bin/phpunit",
"phpunit.args": [
"-c",
"phpunit.xml"
],
"phpunit.paths": {
// ${pwd} (current directory) is mounted to /app
"${workspaceFolder}": "/app",
// ${workspaceFolder} is mapped to /app
},
}
{
"phpunit.command": "ssh -i dockerfiles/sshd/id_rsa -p 2222 root@localhost -o StrictHostKeyChecking=no",
"phpunit.php": "php",
"phpunit.phpunit": "/app/vendor/bin/phpunit",
"phpunit.args": [
"-c",
"/app/phpunit.xml"
],
"phpunit.paths": {
// ${pwd} (current directory) is mounted to /app
"${workspaceFolder}": "/app",
// ${workspaceFolder} is mapped to /app
}
}