View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001467 | Xdebug | Code Coverage | public | 2017-09-11 14:23 | 2017-09-20 20:49 |
Reporter | Alexey | Assigned To | derick | ||
Priority | immediate | Severity | block | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Summary | 0001467: If a function call is splitted into multiple lines then arguments are counted as not covered by tests | ||||
Description | If a function call is splitted into multiple lines then arguments are counted as not covered by tests. We have to format our code, it's vital. | ||||
Steps To Reproduce | <?php | ||||
Tags | No tags attached. | ||||
Operating System | |||||
PHP Version | |||||
|
I believe this is normal PHP behaviour. The parameters within the function call are not executed, only the commas, as they are doing some "work" by separating the parameters. Try placing each comma on a line by itself and testing it again. In fact, it's interesting to place every token on a line of its own and see what PHP considers executed. All the open parentheses are executed, all the commas, some of the closing parentheses, some of the semicolons, the second plus and the closing brace of the method. |
|
@CJ Dennis , sorry, but we have internal code formatting standards. The problem is not in php, but in coverage calculation. |
|
I can't attach a file due to an error in DB collation, this is a screenshot of the example code https://drive.google.com/file/d/0Byxfc0fklW5NbEpKTjFhbVlqcHc/view?usp=sharing |
|
If you use Codeception, which is powered by PHPUnit, which is powered by Xdebug, you'll see that there are four possible statuses for each line: green - executed during the last run The results you are getting are already correct. The red lines you want green are actually white in Codeception's HTML coverage report (i.e. Codeception reports 100% coverage of your test file). You need to educate whoever is responsible for your code standards. I would suggest using Codeception to see the issue more clearly. http://codeception.com/docs/11-Codecoverage |
|
They are not covered, but they're also not considered as executable code. What CJ wrote is correct. PHP simply does not see code on these lines: https://3v4l.org/8YFSF/vld#output If you start code coverage as follows, you will see the four different states: xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE ); |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-09-11 14:23 | Alexey | New Issue | |
2017-09-12 11:33 | CJ Dennis | Note Added: 0004406 | |
2017-09-12 11:40 | Alexey | Note Added: 0004407 | |
2017-09-12 11:44 | Alexey | Note Added: 0004408 | |
2017-09-12 23:04 | CJ Dennis | Note Added: 0004409 | |
2017-09-20 20:42 | derick | Relationship added | has duplicate 0001468 |
2017-09-20 20:42 | derick | Relationship added | has duplicate 0001469 |
2017-09-20 20:49 | derick | Note Added: 0004415 | |
2017-09-20 20:49 | derick | Status | new => resolved |
2017-09-20 20:49 | derick | Resolution | open => no change required |
2017-09-20 20:49 | derick | Assigned To | => derick |