Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#28558 closed enhancement (wontfix)

Add a link to unit tests in function comment block

Reported by: pbearne's profile pbearne Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: docs Cc:

Description

Hi all

There should a link in the comment of a function to point to the location of Unit test for that function.

There is no defined way to find a unit test for a function.
The choices are:
Guess and look files names that look right
Search the test folder
look in a coverage report

I feel it would easier if the a link in the comment block

/*
* @unitTest folder/file
*/

The link should relative the test folder

This we make it easy to see which functions have tests and easy to find and read or run them.

This will also help promote that we have tests :-)

Paul

Change History (5)

#1 @ocean90
10 years ago

  • Focuses docs added
  • Type changed from feature request to enhancement

#2 @netweb
10 years ago

There isn't a @unitTest PHPDoc doc block per http://www.phpdoc.org/docs/latest/references/phpdoc/index.html

Maybe @DrewAPicture can chime in here as WP-Parser would also need to be able to read this.

This ticket was mentioned in IRC in #wordpress-dev by netweb. View the logs.


10 years ago

#4 @DrewAPicture
10 years ago

  • Milestone changed from Awaiting Review to Future Release

The thinking is that we'd eventually move to using something like a custom, vendor-prefixed tag, like @wordpress-tests.

Relevant IRC conversation

#5 @DrewAPicture
10 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I'm going to close this as wontfix. We talked about this at the community summit in October, and the consensus was that that introducing a custom phpDoc tag in this context would ultimately result in bloat on the core docs side.

I've been talking with @boonebgorges and @wonderboymusic to examine whether we can leverage built-in phpunit functionality to generate a variety of code coverage reports. This would be something publicly available on the developer hub.

We also may have an opportunity to generate an index of test coverage in core that should provide the straight-line comparison you're seeking here. Either way, the recommendation going forward would be to approach this from a phpunit-to-core direction, instead of the other way around.

Note: See TracTickets for help on using tickets.