vscode-phpunit
vscode-phpunit copied to clipboard
phpunit.paths mapping not working with warden/den
Same as #133 and #150, but using Den, "a CLI utility for orchestrating Docker based developer environments", which allow to run docker compose commands through den env exec [regular docker-compose exec stuff]
Settings (for whatever reason I can't just use den, I need to use its absolute path):
"phpunit.command": "/home/linuxbrew/.linuxbrew/bin/den env exec -w /var/www/html/dev/tests/unit php-fpm",
"phpunit.phpunit": "../../../vendor/bin/phpunit",
"phpunit.paths": {
"${workspaceFolder}": "/var/www/html"
},
Output:
/home/linuxbrew/.linuxbrew/bin/den env exec -w /var/www/html/dev/tests/unit php-fpm php ../../../vendor/bin/phpunit /home/codeslicer/Projects/somestore/app/code/Company/Module/Test/Unit/Model/AdditionalFeeTest.php --filter=^.*::(testProductWithAdditionalFee)( with data set .*)?$ --teamcity --colors=never
❌ PHPUnit 9.2.6 by Sebastian Bergmann and contributors.
Cannot open file "/home/codeslicer/Projects/magento/app/code/Company/Module/Test/Unit/Model/AdditionalFeeTest.php".
As a reference, this very same setting works fine with PHPUnit extension:
I never used dan but for docker compose I have to specify both "phpunit.command" and "phpunit.php". It might be similar for dan
Check extension page, section Docker
Here is my settings.json
{
"phpunit.command": "docker exec -t app /bin/sh -c",
"phpunit.php": "XDEBUG_MODE=debug XDEBUG_TRIGGER=vscode XDEBUG_SESSION=vscode php",
"phpunit.phpunit": "/var/www/html/vendor/phpunit/phpunit/phpunit",
"phpunit.args": [
"-c",
"phpunit.xml"
],
"phpunit.paths": {
"${workspaceFolder}": "/var/www/html"
},
}
Also open Output panel in and select phpunit in drop down to see which command is being executed when you run the test and then tweak your settings.json based on that
Good luck