View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001227 | Xdebug | Code Coverage | public | 2015-12-08 14:50 | 2020-03-12 17:35 |
Reporter | david.proweb | Assigned To | derick | ||
Priority | high | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 2.3.3 | ||||
Summary | 0001227: Code-coverage: validate each conditional execution | ||||
Description | Currently, if you have a code like: $value = isset($number) ? $number : 0; And your test executes it once, it'll be marked as "code executed". Even if only one of conditional statement was really executed. Same happen on if conditionals. It'll not check if all your code was executed correctly. if (expression1() || // executed It can provide a false code-coverage completion, based on line execution, and not by statement execution. Even if I separate statements in multiline, the code will be ignored as a not covered code, even if it was executed. -- BASE SOLUTION -- I thinking about capture cursor offset when execute statement, and not by line. It'll be great if xdebug_start_code_coverage() have a new option to detail coverage. Example result: Line 0: <?php $number = isset($number) ? $number : 123; ?> $coverage = [
]; After I fix the Line 0 else statement (covering it), results should be: $coverage = [ | ||||
Additional Information | I attached four images.
| ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Operating System | |||||
PHP Version | 5.6.15-5.6.19 | ||||
|
Hi! Xdebug already does something like this - it's the branch/path coverage functionality that's new in Xdebug 2.3. Read about it at http://derickrethans.nl/path-branch-coverage.html — is that doing what you want? cheers, |
|
Yeah, seems like that. The problem in my case is the support on PHP_CodeCoverage. Thanks! |
|
That's being worked on too: https://github.com/sebastianbergmann/php-code-coverage/pull/400 Closing this out now. Have fun! :-) |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-12-08 14:50 | david.proweb | New Issue | |
2015-12-08 14:50 | david.proweb | File Added: xdebug-images.zip | |
2015-12-08 15:41 | derick | Note Added: 0003299 | |
2015-12-08 15:41 | derick | Assigned To | => derick |
2015-12-08 15:41 | derick | Status | new => feedback |
2015-12-08 16:02 | david.proweb | Note Added: 0003300 | |
2015-12-08 16:02 | david.proweb | Status | feedback => assigned |
2015-12-08 16:13 | derick | Note Added: 0003301 | |
2015-12-08 16:13 | derick | Status | assigned => resolved |
2015-12-08 16:13 | derick | Resolution | open => no change required |
2020-03-12 17:35 | derick | Category | Feature/Change request => Code Coverage |