Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#59069 closed enhancement (fixed)

Fix test @covers annotation to refer to use recommended pattern for function names

Reported by: ayeshrajans Owned by: SergeyBiryukov
Priority: normal Milestone: 6.4
Component: Build/Test Tools Version:
Severity: trivial Keywords: has-patch has-unit-tests
Cc: Focuses: coding-standards

Description

PHPUnit @covers annotations recommend declaring the function names with a :: prefix. We already do so for a lot of functions, but this found two instances that were missing the prefix.

https://docs.phpunit.de/en/10.0/code-coverage.html#code-coverage-specifying-covered-parts

Change History (4)

This ticket was mentioned in PR #4994 on WordPress/wordpress-develop by @ayeshrajans.


3 years ago
#1

  • Keywords has-unit-tests added

PHPUnit @covers annotations recommend declaring the function names with a :: prefix. We already do so for a lot of functions, but this found two instances that were missing the prefix.

Trac ticket: https://core.trac.wordpress.org/ticket/59069

#2 @SergeyBiryukov
3 years ago

  • Component GeneralBuild/Test Tools
  • Milestone Awaiting Review6.4

#3 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 56384:

Tests: Correct two @covers annotations to use the recommended pattern.

When global functions are covered, they need to be prefixed with :: (double colon) to distinguish them from class name.

Reference: PHPUnit Manual: @covers annotation.

Follow-up to [48848], [49305], [53741], [56296].

Props ayeshrajans.
Fixes #59069.

@SergeyBiryukov commented on PR #4994:


3 years ago
#4

Thanks for the PR! Merged in r56384.

Note: See TracTickets for help on using tickets.