Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI flag to generate only one type of CC & Logging regardless of phpunit.xml #4401

Closed
Slamdunk opened this issue Aug 7, 2020 · 8 comments
Assignees
Labels
feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Milestone

Comments

@Slamdunk
Copy link
Contributor

Slamdunk commented Aug 7, 2020

Hi, I'm the current maintainer of https://github.com/paratestphp/paratest, a tool to run PHPUnit in parallel, leveraging sub-processes.

A feature we must provide is to generate code-coverage and logging accordingly to phpunit.xml specifications.

Our tool should:

  1. Read phpunit.xml <filter/coverage> and <logging> sections, which may all set to all the available configurations
  2. Disable all of them during ParaTest process
  3. Enable only coverage-php and log-junit into PHPUnit sub-processes
  4. Wait for sub-processes to finish and to generate the only two cc+log above
  5. Merge everything together within ParaTest process
  6. Generate the desired cc/logs respecting again phpunit.xml <filter/coverage> and <logging> sections

As of yet this can't be done because if <filter/coverage> and <logging> sections are specified in phpunit.xml, cc and logs are always generated except with --no-coverage/--no-logging active, but with --no-coverage/--no-logging active no cc nor logs are generated at all.

The workaround we are using right now is suggesting not to have any section in phpunit.xml except the <whitelist> one, and specify each option in the CLI, so ParaTest can easily rewrite them as wish, but of course this is sub-optimal.

So I'm asking something like vendor/bin/phpunit --no-coverage --coverage-php tmp.php --no-logging --log-junit tmp.log.

If you so kind to write down few instructions to how and where implement such feature, I'm happy to propose a PR.

@Slamdunk Slamdunk added the type/enhancement A new idea that should be implemented label Aug 7, 2020
@sebastianbergmann
Copy link
Owner

vendor/bin/phpunit --no-coverage --coverage-php tmp.php --no-logging --log-junit tmp.log

The above makes sense to me and I will implement this for PHPUnit 9.4.

@sebastianbergmann sebastianbergmann self-assigned this Aug 7, 2020
@sebastianbergmann sebastianbergmann added this to the PHPUnit 9.4 milestone Aug 7, 2020
@sebastianbergmann sebastianbergmann added the feature/test-runner CLI test runner label Aug 7, 2020
@Slamdunk
Copy link
Contributor Author

Slamdunk commented Aug 7, 2020

Ping @Jean85 as this may help your https://github.com/facile-it/paraunit too

@Jean85
Copy link
Contributor

Jean85 commented Aug 7, 2020

Thanks for the ping but I follow a different approach, without altering the original XML config; I only use CLI options.

@sebastianbergmann
Copy link
Owner

As I mentioned here: IMO, XML configuration manipulation should be avoided by tools that wrap PHPUnit. Please let me know, as @Slamdunk did with this ticket, if you are missing CLI options.

@Slamdunk
Copy link
Contributor Author

Slamdunk commented Aug 7, 2020

Thanks for the ping but I follow a different approach, without altering the original XML config; I only use CLI options.

This is going OT, by the way we don't manipulate anything. @Jean85 if you run phpunit bare binary in a sub-processes, it will generate any cc/log written in phpunit.xml, (currently) regardless if you add more or less options, except for --no-* ones.

@sebastianbergmann
Copy link
Owner

@Slamdunk Thank you for the clarification!

@sebastianbergmann
Copy link
Owner

I think this should be done after #4292.

@sebastianbergmann
Copy link
Owner

Supersed by #4446.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/enhancement A new idea that should be implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants