[wp-trac] [WordPress Trac] #39265: Missing @covers in the comment blocks in PHPUnit tests (was: Missing @covers and @uses in the comments block in phpunt test for wordpress)
WordPress Trac
noreply at wordpress.org
Sun Aug 23 14:48:12 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:
------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => accepted
Old description:
> PHPUnit has a comment block notation @cover and @uses that we are not
> using so we can create coverage report to see how much of WordPress has
> test
>
> https://thephp.cc/news/2014/03/phpunit-4-0-code-coverage-improvements
> http://blog.teamlazerbeez.com/2009/08/18/phpunit-annotations/#covers
> https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.covers
>
> @covers tells PHPUnit that this test what the test function is testing
> {{{
> /**
> * @covers Class_Name::function_name
> */
> }}}
>
> @uses tells PHPunit that the test is using another function to help test
> the @covers function but this test is not testing it so it should ignore
> it for the covers report
> {{{
> /**
> * @covers Class_Name::function_name
> * @uses Other function
> */
> }}}
>
> ''note: if the @ covers function that is not in a class and in global
> namespace then the notation is like this''
>
> {{{
> /**
> * @covers ::function_name
> */
> }}}
>
> This ticket is place holder for how and what the changes need to be so
> that we can encourage the fixing of this.
New description:
PHPUnit has a comment block notation @cover and @uses that we are not
using so we can create coverage report to see how much of WordPress has
tests
https://thephp.cc/news/2014/03/phpunit-4-0-code-coverage-improvements
http://blog.teamlazerbeez.com/2009/08/18/phpunit-annotations/#covers
https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.covers
@covers tells PHPUnit that this test what the test function is testing
{{{
/**
* @covers Class_Name::function_name
*/
}}}
@uses tells PHPunit that the test is using another function to help test
the @covers function but this test is not testing it so it should ignore
it for the covers report
{{{
/**
* @covers Class_Name::function_name
* @uses Other function
*/
}}}
''note: if the @ covers function that is not in a class and in global
namespace then the notation is like this''
{{{
/**
* @covers ::function_name
*/
}}}
This ticket is place holder for how and what the changes need to be so
that we can encourage the fixing of this.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39265#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list