Replies: 1 comment 2 replies
-
|
The core issue here is that PHPUnit needs to be run from the The SolutionUse the Option 1: Absolute bootstrap path {
"phpunit.phpunit": "${workspaceFolder}/vendor/bin/phpunit",
"phpunit.args": [
"--configuration",
"${workspaceFolder}/tst/phpunit.xml",
"--bootstrap",
"${workspaceFolder}/tst/Bootstrap.php"
]
}This bypasses the relative path issue in Option 2: Shell wrapper (recommended for CWD-dependent projects) Create a wrapper script #!/bin/bash
cd "$(dirname "$0")" && exec ../vendor/bin/phpunit "$@"Then configure: {
"phpunit.phpunit": "${workspaceFolder}/tst/run-phpunit.sh",
"phpunit.args": [
"--configuration",
"${workspaceFolder}/tst/phpunit.xml"
]
}This ensures PHPUnit runs with About the Xdebug errorThe Xdebug warning ( {
"phpunit.args": ["-d", "xdebug.mode=off"]
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Coming from #333 and thanks for your help. I tried to reproduce it again. As said, just creating a codespace on https://github.com/PrivateBin/PrivateBin/ (and installing the extension, which should be suggested) is enough for reproducing.
STR
I have made PrivateBin/PrivateBin#1790 (with the adjustments below) for easier reproducing, though.
Then just click the "Run all tests" in the sidebar. Note I explicitly do not click "debug [tests]" or so, so I don't really know why it comes up with xdebug at all…
The issue
We have the tests (and
phpunit.xmlin a sub-directory) and as per our documentation you also need to run the tests from inside the./tstdirectory, aka the CWD of phpunit needs to be there when started.Here is a link to the full config file (it uses relative paths, so well…): https://github.com/PrivateBin/PrivateBin/blob/dd69cb89afb4dd4168a6d43abd6d05d78658df4a/tst/phpunit.xml
Tries
I thus created this config here:
{ "phpunit.phpunit": "${workspaceFolder}/vendor/bin/phpunit", "phpunit.args": [ "--configuration '${workspaceFolder}/tst/phpunit.xml'" ] }That also seems to work, but now I get a strange XDebug error (I did not even try to start a roper debugging session):
version
Name: PHPUnit & Pest Test Explorer
ID: recca0120.vscode-phpunit
Beschreibung: Run PHPUnit and Pest tests in VS Code with the native Test Explorer. Supports Docker, SSH, Laravel Sail, ParaTest, and Xdebug step-debugging.
Version: 3.8.5
Herausgeber: Recca0120
Link zum Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=recca0120.vscode-phpunit
Beta Was this translation helpful? Give feedback.
All reactions