vscode-phpunit
vscode-phpunit copied to clipboard
Spaces in configuration file path Test Suite - Win 10
Related issue https://github.com/elonmallin/vscode-phpunit/issues/37 (Spaces in file path in windows 10)
Seems the above issue was fixed for running the phpunit command initially, however the configuration phpunit.xml file is encountering the same issue, as can been seen in the log output, the configuration file is not enclosed with quotes.
Running individual tests with files open does work properly.
Repro
Run Test Suite in a project in Windows 10 that has a space in the absolute file path.
Outcome
The test suite does prompt to choose which tests to initially run;
however after selecting any option, the error below shows and the test fails to run.
Expected outcome
The test should run successfully
Logs / output / settings
> Executing task: php 'c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/vendor/phpunit/phpunit/phpunit' --colors=always --colors=always --colors=always -c c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/phpunit.xml <
PHPUnit 9.2.5 by Sebastian Bergmann and contributors.
Cannot open file "Foo/Bar".
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
Environment | Values |
---|---|
Extension version | 4.1.0 |
Operating system | Windows 10 |
I am experiencing the same issue.
> Executing task: '/Users/{user}/Documents/Work/123 Plugins/vendor/bin/phpunit' --colors=always -c /Users/{user}/Documents/Work/123 Plugins/phpunit.xml --testsuite 'unit' <
PHPUnit 9.4.0 by Sebastian Bergmann and contributors.
Cannot open file "Plugins/phpunit.xml".
The terminal process "/usr/local/bin/zsh '-c', ''/Users/{user}/Documents/Work/123 Plugins/vendor/bin/phpunit' --colors=always -c /Users/{user}/Documents/Work/123 Plugins/phpunit.xml --testsuite 'unit''" failed to launch (exit code: 1).
Environment | Values |
---|---|
Extension version | 4.1.1 |
Operating system | macOS 10.15.7 |
Same issue in my case. The issue seems to be that the path to the XML file is not wrapped in quotes. This command raises the error:
php 'c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/vendor/phpunit/phpunit/phpunit' --colors=always -c c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/phpunit.xml
This one, with the quotes around the path to the phpunit.xml
file, works:
php 'c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/vendor/phpunit/phpunit/phpunit' --colors=always -c 'c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/phpunit.xml'
Environment | Values |
---|---|
Extension version | 4.1.1 |
Operating system | Windows 10 |
It looks like the above fix from @daigo75 would fix this issue, is there any chance it could get pulled in?
Same issue happen when runs test individually.
Thanks, a new release is out with the test suites wrapped in single quotes. Added some tests and pipe to release so should be smoother in the future.