sebastianbergmann/phpunit-documentation-english

Writing PHPT tests

jrfnl opened this issue · 5 comments

jrfnl commented

While most people will primarily write unit tests, at times, it will be useful to write phpt style tests.

Typical use cases include, but are not limited to:

  • End to end tests for CLI tools (including PHPUnit itself)
  • Getting at least some tests in place for legacy codebases which have spaghetti code to safeguard against regressions before refactoring the code.

There is (project specific) information available about the phpt format in the PHP project itself, but that information is not one-on-one applicable for phpt for PHPUnit.

I believe it would be beneficial to add a section to the PHPUnit documentation about writing phpt tests, which at the very least documents the available sections.

I never really thought of the PHPT support in PHPUnit's test runner as a "public" feature, and more of an "internal" feature that is used to implement end-to-end tests for PHPUnit's test runner. That is/was probably wrong.

jrfnl commented

It's definitely a barely known feature, but it is something I have been playing with for a couple of projects now and I'd find it helpful to be able to point project contributors somewhere (quite apart from having the chance to learn more about what I can do with the format myself).

apart from having the chance to learn more about what I can do with the format myself

Do I understand this correctly that you volunteer to write this documentation? :)

jrfnl commented

Not necessarily, but willing to give it a try when I have some time (next year or something... way too busy still for now)

Okay, no worries.