Environment
OS: [macOS]
VS Code version: [e.g., 1.88.0]
PHP Tools for VS Code version: [e.g., 1.45.0]
PHP: 7.4.33
PHPUnit: 9.5.25
Docker: webserver, mysql, redis containers via docker-compose.yml
Problem Description
I configured the Devsense Sandbox to execute PHPUnit inside a Docker container, but the Test Explorer UI either shows an empty tree, fails to discover tests, or returns an error/timeout when I try to run or debug them. The tests execute perfectly when run manually from the host terminal:
docker compose exec -T webserver php /var/www/html/processing/vendor/bin/phpunit tests
However, PHP Tools does not seem to bridge the execution or path mapping correctly for the Test Explorer.
{
"php.sandbox.enabled": true,
"php.sandbox.docker.command": "docker compose -f ../../docker-compose.yml exec -T -w /var/www/html/processing webserver",
"phpunit.command": "./vendor/bin/phpunit",
"phpunit.config": "phpunit.xml",
"phpunit.tests": "/var/www/html/processing/tests",
"phpunit.autoDiscover": true,
"phpunit.pathMappings": {
"/var/www/html/processing": "${workspaceFolder}"
},
"php.debug.enabled": true,
"php.debug.port": 9000,
"php.debug.ideKey": "VSCODE",
"php.validate.executablePath": ""
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="bootstrap.php"
cacheResultFile=".phpunit.cache/test-results"
executionOrder="depends,defects"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
verbose="true"
colors="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">app</directory>
</include>
<exclude>
<directory>vendor</directory>
<directory>tests</directory>
<directory>.phpunit.cache</directory>
<directory>static</directory>
</exclude>
</coverage>
</phpunit>
No PHP Tools or PHP Debug output channels
Question
Could you advise if the phpunit.pathMappings or php.sandbox.docker.command is correctly formatted for this Docker setup? Is there anything specific to legacy PHP 7.4 projects (without PSR-4 autoloading) that might block test discovery? Any guidance on enabling verbose logging for the Test Explorer or sandbox execution would be greatly appreciated.
Thank you for your time and for the excellent tooling!