Skip to content

PHPUnit Test Explorer fails to run tests on paths containing spaces (PHPUnit 10, PHP 8.1.10) #335

@boringmj

Description

@boringmj

I encountered an issue running tests using the PHPUnit Test Explorer extension (v3.7.10) with PHPUnit 10 on PHP 8.1.10.

When the test file path contains spaces, the generated command does not quote the file path properly, causing PHPUnit to fail:

Generated command:

php d:\All Project\adminservice-collaboration\vendor\bin\phpunit --filter=^.*::(testApp)(( with (data set )?.*)?)?$ d:\All Project\adminservice-collaboration\tests\AppTest.php --colors=never --teamcity

Error:

❌ PHPUnit 10.0.0 by Sebastian Bergmann and contributors.

Test file "d:\All" not found

Expected behavior:
File paths containing spaces should be properly quoted, for example:

php "d:\All Project\adminservice-collaboration\vendor\bin\phpunit" --filter=... "d:\All Project\adminservice-collaboration\tests\AppTest.php" ...

Steps to reproduce:

Install PHP 8.1.10, PHPUnit 10, and PHPUnit Test Explorer 3.7.10.

Open a project whose path contains spaces.

Run a test from the Test Explorer UI.

Observe the command generated and the error output.

Environment:

PHP: 8.1.10

PHPUnit: 10

PHPUnit Test Explorer: 3.7.10

VS Code: 1.104.1 (user setup)

OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions