Skip to content

Enumerations cannot be targeted for code coverage #1061

Description

@doppynl
Q A
PHPUnit version 12.0.1
PHP version 8.4.2
Installation Method Composer
Code coverage XDebug 3.4.0

Summary

Unable to configure code coverage for Enums.

Current behavior

When configuring coverage or usage using coversClass or usesClass attributes it gives me the following error:
Class ..... is not a valid target for code coverage

I tried configuring coverage using coversNamespace but got a similar error.

How to reproduce

Create an Enum and try to configure coverage in a TestCase.

Expected behavior

I can configure coverage for an Enum on my TestCases.

Maybe with specific attributes like coversEnum and usesEnum, but the ...Class attributes might work just fine if they accept enums.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions