Skip to content

simple-phpunit cannot load sub phpunit.xml.dist #45689

Closed
@michel-maier

Description

@michel-maier

Symfony version(s) affected

5.2.12

Description

According the documentation :

The modified PHPUnit script will recursively go through the provided directory, up to a depth of 3 subdirectories or the value specified by the environment variable SYMFONY_PHPUNIT_MAX_DEPTH, looking for phpunit.xml.dist files and then running each suite it finds in parallel, collecting their output and displaying each test suite's results in their own section.

But when I executed tests, the sub phpunit.xml.dist files were not used at all.

How to reproduce

Create two suites (Functional and Unit) like explained in the documentation. We can easily test by setting a different phpunit bootstrap file in each phpunit.xml.dist.

https://symfony.com/doc/current/components/phpunit_bridge.html#running-tests-in-parallel

Neither will be used.

Possible Solution

I debugged the simple-php script step by step and I noticed the command was probably malformed.
The command is constructed at line 366/367 in simple-phpunit.php and it is passed to the proc_open function at line 388.

This is the constructed command:

'/usr/local/bin/php' '/opt/vendor/bin/.phpunit/phpunit-8.3-0/phpunit' --colors=always 'tests/Functional' > 'tests/Functional'/phpunit.stdout 2> 'tests/Functional'/phpunit.stderr

phpunit is launched at the root of the project, I assume that the -c|--configuration option is missing before the folder name.

'/usr/local/bin/php' '/opt/vendor/bin/.phpunit/phpunit-8.3-0/phpunit' --colors=always -c 'tests/Functional' > 'tests/Functional'/phpunit.stdout 2> 'tests/Functional'/phpunit.stderr

Additional Context

Unfortunately I'm working on an old unsupported version of symfony (3.4.49)... Actually, my job is to upgrade it.
But I still use a recent version of the package as recommended by the documentation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions