WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#36867 closed defect (bug) (fixed)

Enable phpunit to be run with codecoverage

Reported by: jorbin Owned by: jorbin
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:
PR Number:

Description

phpunit --coverage-clover=clover.xml currently fails. It has failed since [36318] (woops).

phpunit 5.0 also makes the use of a whitelist for code coverage mandatory. See https://github.com/sebastianbergmann/phpunit-documentation/issues/335

Change History (5)

#1 @jorbin
3 years ago

In 37445:

Correct usage of Covers for Tests_Update_Comment_Count_Now

When @covers is used with a plain alphanumeric string, PHPUnit assumes that it is covering a class. If there is no class, it fails and exits rather than continuing to generate coverage. To cover a global function, the name must start with ::. See https://phpunit.de/manual/5.3/en/appendixes.annotations.html#appendixes.annotations.covers

See #35060, #36867

#2 @jorbin
3 years ago

In 37447:

Correct usage of Covers for Tests_Update_Comment_Count_Now

When @covers is used with a plain alphanumeric string, PHPUnit assumes that it is covering a class. If there is no class, it fails and exits rather than continuing to generate coverage. To cover a global function, the name must start with ::. See https://phpunit.de/manual/5.3/en/appendixes.annotations.html#appendixes.annotations.covers

[37445] for trunk

See #35060, #36867

#3 @jorbin
3 years ago

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

In 37449:

Set a whitelist for PHPUnit code coverage.

PHPUnit requires a whitelist as of version 5 in order to generate code coverage. See https://github.com/sebastianbergmann/phpunit-documentation/issues/335 .

Fixes #36867.

#4 @jorbin
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#5 @jorbin
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 37459:

Correct usage of @Covers for Tests_Post_Types

When @covers is used with a plain alphanumeric string, PHPUnit assumes that it is covering a class. If there is no class, it fails and exits rather than continuing to generate coverage. To cover a global function, the name must start with ::. See https://phpunit.de/manual/5.3/en/appendixes.annotations.html#appendixes.annotations.covers

Introduced in [36768].

Fixes #36867. See #35985

Note: See TracTickets for help on using tickets.