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

WordPress Trac noreply at wordpress.org
Mon Feb 8 16:30:02 UTC 2021


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

Comment (by SergeyBiryukov):

 Replying to [comment:24 jrf]:
 > I've done an initial review of the submitted patches adding new covers
 tags for commit readiness.

 This is great, thank you!

 > == functions_folder.patch
 >
 > * `@covers` syntax is correct.
 > * In a number of places superfluous empty docblocks lines are introduced
 at the start or end of a docblock. These need to be removed. Examples:
 >   - `tests/phpunit/tests/functions/allowedProtocols.php` line 19.
 >   - `tests/phpunit/tests/functions/canonicalCharset.php` all except the
 last one.
 >   - `tests/phpunit/tests/functions/wpAuthCheck.php` line 31.
 > * `@covers` tags need to be in docblock comments, i.e. the comment block
 needs to start with `/**`. In file
 `tests/phpunit/tests/functions/wpListFilter.php`, changes between line 42
 and 162, this is not the case.

 Looks like this feedback was addressed in
 [attachment:"functions_folder.2.patch"], but it also seems that this patch
 is now redundant, as the `phpunit/tests/functions/` folder was already
 addressed in [49006]. I've made a few adjustments in that commit to add
 `@covers` tags to the whole class instead of individual methods where
 appropriate, per this part of comment:7:
 > Also note: The tests don't all have to have individual `@covers` tags.
 If a test class, through a variety of tests,  covers all aspect of one
 particular function, a single `@covers` tag for that function in the test
 class docblock will suffice. Same if a test class covers every aspect of a
 class. A single `@covers` tag referencing the covered class in the test
 class docblock is enough in that case.

 @jrf Please let me know if [49006] looks correct or any follow-up changes
 are needed. Thanks!

 Looking into other patches now :)

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


More information about the wp-trac mailing list