Make WordPress Core

Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#59069 closed enhancement (fixed)

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

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

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.


12 months 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
12 months ago

  • Component changed from General to Build/Test Tools
  • Milestone changed from Awaiting Review to 6.4

#3 @SergeyBiryukov
12 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

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:


12 months ago
#4

Thanks for the PR! Merged in r56384.

Note: See TracTickets for help on using tickets.