Anonymous | Login | Signup for a new account | 2018-04-19 22:32 BST | ![]() |
My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0001088 | Xdebug | Usage problems (Wrong Results) | public | 2014-11-16 12:33 | 2014-12-02 21:28 | ||||||||
Reporter | deeped | ||||||||||||
Assigned To | derick | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | closed | Resolution | fixed | ||||||||||
Platform | Windows | OS | 7 | OS Version | |||||||||
Product Version | 2.2.5 | ||||||||||||
Target Version | Fixed in Version | 2.2.7 | |||||||||||
Summary | 0001088: xdebug wont show dead and not executed lines at the 2nd time | ||||||||||||
Description | Here is a "test": class TestMe { public function test_ok() { $a = new TestMe2(); $a->test_forgotToCall(); } public function test_deadcode() { $a = 1; return; $a = 'this line wont be executed'; } public function test_notExecuted() { $a = 'this line wont be executed'; } } class TestMe2 { public function test_forgotToCall() { $a = 1; // I "accidentally" forget to call this at the 2nd test } public function test2() { $a = 1; } } xdebug_start_code_coverage (XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); $testObj = new TestMe(); $testObj->test_ok(); $testObj->test_deadcode(); //$testObj->test_notExecuted(); so not executed var_dump (xdebug_get_code_coverage()); xdebug_stop_code_coverage(); xdebug_start_code_coverage (XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); $testObj = new TestMe2(); //$testObj->test_forgotToCall(); $testObj->test2(); var_dump (xdebug_get_code_coverage()); xdebug_stop_code_coverage(); the first test runs OK, but at the 2nd time, xdebug_get_code_coverage() just wont show the "unused" and "deadcode" lines, only the rans. If I pass false to xdebug_stop_code_coverage() then it does, but then the covered lines are "summed" so the fact that I forgot to test the test_forgotToCall() function will never turns our. (TestMe calls test_forgotToCall() so it will be covered. But TestMe2 doesnt call it, so test_forgotToCall() must be uncovered, but since TestMe had called it, it just wont turn out http://i.stack.imgur.com/ka2u1.gif [^] | ||||||||||||
Tags | No tags attached. | ||||||||||||
Operating System | |||||||||||||
PHP Version | 5.4.2 | ||||||||||||
Attached Files | ![]() | ||||||||||||
![]() |
|
(0002925) derick (administrator) 2014-12-02 21:28 |
Fixed for 2.2.7 and 2.3.0dev, through https://github.com/xdebug/xdebug/pull/134 [^] |
![]() |
|||
Date Modified | Username | Field | Change |
2014-11-16 12:33 | deeped | New Issue | |
2014-11-16 12:33 | deeped | File Added: code.gif | |
2014-12-02 21:28 | derick | Note Added: 0002925 | |
2014-12-02 21:28 | derick | Status | new => closed |
2014-12-02 21:28 | derick | Assigned To | => derick |
2014-12-02 21:28 | derick | Resolution | open => fixed |
2014-12-02 21:28 | derick | Fixed in Version | => 2.2.7 |
2016-07-31 13:36 | derick | Category | Usage problems => Usage problems (Crashes) |
2016-07-31 13:38 | derick | Category | Usage problems (Crashes) => Usage problems (Wrong Results) |
Copyright © 2000 - 2018 MantisBT Team |