- Install phpunit or have phpunit installed through composer.
- Set the config values:
{
"phpunit.execPath": "path/to/phpunit", // If this value is set to '' it will try to use the composer phpunit installation.
"phpunit.args": [
"--configuration", "./phpunit.xml.dist"
]
}
Run with (Cmd+Shift+P
on OSX or Ctrl+Shift+P
on Windows and Linux) and execute:
PHPUnit Test Nearest
: This command will search the nearest function from the cursor position until the file's beginning.
PHPUnit Test Current File
: This command will test the current active file.
PHPUnit Test All Suite
: This command will run all the test suite.
PHPUnit Test
: This command will show a window to pick the test to run.
PHPUnit Run Last Test
: This command will run the last test ran.
PHPUnit Cancel Current Test
: This command will cancel the current running test.
- args is recommended to set in your 'workspace settings'. You can add any phpunit args, check phpunit --help.
- To hook into the debugger (github.com/felixfbecker/vscode-php-debug). Add Key:
XDEBUG_CONFIG
, Value:idekey=VSCODE
to your environment variables.