We already have the reverse convention where in a phpUnit test docblock it is normal to use the @covers
annotation.
If you are looking at a piece of code it is often helpful to look at tests that exercise that logic to understand what the code is supposed to do. In PHP, is there a convention to document in your code where to find the tests that was written to exercise the function? If not, we plan to adopt our own convention and are considering one of these options:
- use the phpDocumentor
@internal
annotation - use a completely custom annotation like
@spec
- just a free comment in the docblock, but styled in a quick recognisable pattern
- don't document but find out where it is tested by commenting out the code, run the test suite and see which tests fail.
Are there any warnings against using any of these?