Phpunit: Switch cases not being covered

Created on 7 Jan 2018  路  8Comments  路  Source: sebastianbergmann/phpunit

| Q | A
| --------------------| ---------------
| PHPUnit version | 6.5.5
| PHP version | 7.2.0 windows
| Installation Method | PHAR

the problem is that lines with the switch case are not covered, the switch cases themselves are being executed.

2018-01-06_22-13-01

Most helpful comment

@eghojansu experiencing same issue, Xdebug has this fixed but phpdbg doesn't

All 8 comments

This should have been reported on the php-code-coverage project.

I am sorry that I have to close this issue here as GitHub does not support moving issues from one project to another.

This is probably an Xdebug issue, see https://github.com/xdebug/xdebug/pull/398.

CC @derickr

Looks like it. But that issue is already fixed in Xdebug's master branch.

I am using phpdbg and get this issue too.

PHPUnit 7.5.1
phpdbg 0.5.0 (built: Sep 13 2018 13:45:02)
PHP 7.2.10-0ubuntu0.18.04.1, Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

@eghojansu experiencing same issue, Xdebug has this fixed but phpdbg doesn't

any ideas for a possible solution with phpdbg?

I'm also getting this when using phpdbg / phpunit 8.4.3.

Workaround is to move the case statements onto one line (which fortunately is practical in this case).

Can we re-open this or should I post a new issue?

Hi @dmlogic, thats a temporary solution. On my company, we solve with EnumClass. More options and information here: https://stackoverflow.com/a/58766230/860878

Also, @sebastianbergmann post on my question this:

Do yourself a favor and do not use PHPDBG for code coverage. Use PCOV oder Xdebug instead

Was this page helpful?
0 / 5 - 0 ratings