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

--log-events-text and --log-events-verbose-text require the destination file to exit #5692

Closed
mfn opened this issue Feb 3, 2024 · 2 comments
Assignees
Labels
feature/test-runner CLI test runner type/bug Something is broken version/10 Something affects PHPUnit 10 version/11 Something affects PHPUnit 11

Comments

@mfn
Copy link

mfn commented Feb 3, 2024

Q A
PHPUnit version 11.0.1
PHP version 8.3.2
Installation Method Composer / PHAR

Summary

When trying to use either --log-events-text or --log-events-verbose-text with a filename, the following error is shown:

 $ vendor/bin/phpunit --log-events-text events.txt
PHPUnit 11.0.1 by Sebastian Bergmann and contributors.

The path "events.txt" specified for the --log-events-text option could not be resolved

The docs at https://docs.phpunit.de/en/11.0/textui.html say

Stream events as plain text to file.

Nowhere is mentioned that the destination file has to exist.

The following works:

 $ touch events.txt
 $ vendor/bin/phpunit --log-events-text events.txt
…
  • I only found out after digging into the source code
  • Although the file has to be present, any contents will be overwritten

It would be great if the docs would properly reflect that (maybe also that things like php://stdout are supported, which I found out via #5633).

At best, it would simply accept any file name like any of the other log options (like --log-junit, etc.)

Thanks!

@mfn mfn added the type/bug Something is broken label Feb 3, 2024
@sebastianbergmann sebastianbergmann added version/10 Something affects PHPUnit 10 version/11 Something affects PHPUnit 11 feature/test-runner CLI test runner labels Feb 4, 2024
@sebastianbergmann
Copy link
Owner

Nowhere is mentioned that the destination file has to exist.

This behaviour is not intended.

@sebastianbergmann sebastianbergmann self-assigned this Feb 4, 2024
@sebastianbergmann sebastianbergmann changed the title --log-events-text and --log-events-verbose-text unclear that the destination file has to exit --log-events-text and --log-events-verbose-text require the destination file to exit Feb 4, 2024
@mfn
Copy link
Author

mfn commented Feb 4, 2024

Thank you 🙏🏼

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/bug Something is broken version/10 Something affects PHPUnit 10 version/11 Something affects PHPUnit 11
Projects
None yet
Development

No branches or pull requests

2 participants