[wp-trac] [WordPress Trac] #39265: Missing @covers in the comment blocks in PHPUnit tests

WordPress Trac noreply at wordpress.org
Mon Aug 24 15:10:51 UTC 2020


#39265: Missing @covers in the comment blocks in PHPUnit tests
------------------------------+-----------------------------
 Reporter:  pbearne           |       Owner:  SergeyBiryukov
     Type:  enhancement       |      Status:  accepted
 Priority:  normal            |   Milestone:  5.6
Component:  Build/Test Tools  |     Version:  4.8
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+-----------------------------

Comment (by jrf):

 Replying to [comment:10 pbearne]:
 > Are we go on for lots of little patches or should this get done on
 github and get pushed one big patch?

 @pbearne Well, it is a lot of work and to do this right, every tests
 without the `@covers` tag will need to "studied" to see what the test
 coverage intention was when the test was added, possibly tracing this back
 to the patch/ticket via which the test was added etc. For some this will
 be simple (only one WP method/function is being called), for some not so
 much.

 With that in mind, I think starting with small patches, something like a
 file (if complex) or directory (if not that complex) at a time, would
 probably be the way forward.

 Once the number of `@covers` tags has increased significantly, we could
 consider one final patch to finish it off.

 I'm working on setting up a PHPUnit QA standard for PHP_CodeSniffer which
 could help detect missing `@covers` tags as well as incorrect ones.
 Unfortunately that isn't public yet, though the
 [https://github.com/Yoast/yoastcs YoastCS] PHP_CodeSniffer standard
 contains some preliminary versions of sniffs, but those are in part too
 specificly attuned to their codebases to be used for WP Core for now.

 All the same, if I adjust those slightly and do a scan, I currently see
 there are (at least) **3298** test methods which don't have a `@covers`
 tag either at the method or the class level and **191** `@covers` tags for
 which the `()` at the end should be removed. That last bit can be auto-
 fixed, so I'll upload a patch for that in a minute.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39265#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list