This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258313 - Code coverage for interfaces and empty classes
Summary: Code coverage for interfaces and empty classes
Status: STARTED
Alias: None
Product: php
Classification: Unclassified
Component: PHPUnit (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-10 18:54 UTC by twifty
Modified: 2016-08-15 12:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description twifty 2016-03-10 18:54:25 UTC
Using PHPUnit 5.2.9, when running tests all interfaces shown in the report window are marked as having 0% coverage. Since there is no code in these files, they should be either excluded from the report or marked as being 100% covered. The same is true for empty classes (useful with the instanceof operator):

class foo extends bar
{
}

The output from PHPUnit, in both cases, shows 0 methods and 0 covered methods.
Comment 1 Tomas Mysik 2016-03-11 08:20:26 UTC
IMO if the classes are not tested in any tests then their coverage is 0 % and not 100 % (no matter if they are  empty or not). But I am open for discussion here but please, first read this blog post [1] (chapter "Improved code coverage report") to ensure that there will be no regression in the current behavior.

Closing for now, feel free to reopen.

Thanks,
Tomas
[1] https://blogs.oracle.com/netbeansphp/entry/recent_improvements_in_phpunit_support
Comment 2 dasprid 2016-05-23 22:41:22 UTC
Thomas, I have to highly disagree with that. Since interfaces can technically not be tested (that's also why PHPUnit always shows them as "0 of 0 lines covered", I'd argue that they should be considered tested by the code coverage report in NetBeans.

Any other reporting tool, including the HTML generated by PHPUnit itself, shows those files as 100% tested.
Comment 3 Tomas Mysik 2016-05-24 08:01:06 UTC
OK, will have a look at it but cannot promise anything, not sure what _exact_ data we get from PHPUnit. But will try to investigate it.

Thanks for reporting.
Comment 4 Tomas Mysik 2016-08-15 12:54:30 UTC
It would be great if you could attach a sample project (with empty classes, interfaces, traits etc.) together with generated code coverage by PHPUnit (e.g. in some of its subfolder, as an HTML report). Please, use some newer version of PHPUnit.

Thanks.