View Issue Details

IDProjectCategoryView StatusLast Update
0000992Xdebugpublic2014-03-05 09:17
Reporterchrislondon Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionduplicate 
PlatformMacbook ProOSOS XOS Version10.8.4
Product Version2.2.3 
Summary0000992: Incomplete Code Coverage
Description

I'm unable to get complete code coverage in PHPUnit. It appears xdebug is reporting that "break;" and "$var++;" are executable but aren't being executed. I don't think this is a PHPUnit issue.

Steps To Reproduce
  • Set up PHPUnit to use xDebug for code coverage.
  • Create a test that includes a switch statement with breaks and/or a line that uses a ++;
Additional Information

Using:
PHP_CodeCoverage 1.2.13
PHP 5.4.16
PHPUnit 3.7.28

TagsNo tags attached.
Attached Files
Feedback_src_Feedback_CodeCoverage.php.html (16,766 bytes)   
<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Code Coverage for /Users/ChrisLondon/Websites/zend/module/Feedback/src/Feedback/CodeCoverage.php</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">
  <!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <![endif]-->
 </head>
 <body>
  <header>
   <div class="container">
    <div class="row">
     <div class="span12">
      <ul class="breadcrumb">
        <li><a href="index.html">/Users/ChrisLondon/Websites/zend/module</a> <span class="divider">/</span></li>
        <li><a href="Feedback.html">Feedback</a> <span class="divider">/</span></li>
        <li><a href="Feedback_src.html">src</a> <span class="divider">/</span></li>
        <li><a href="Feedback_src_Feedback.html">Feedback</a> <span class="divider">/</span></li>
        <li class="active">CodeCoverage.php</li>

      </ul>
     </div>
    </div>
   </div>
  </header>
  <div class="container">
   <table class="table table-bordered">
    <thead>
     <tr>
      <td>&nbsp;</td>
      <td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
      <td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
      <td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
      <td colspan="3"><div align="center"><strong>Lines</strong></div></td>
     </tr>
    </thead>
    <tbody>
     <tr>
      <td class="danger">Total</td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;2</div></td>
      <td class="danger small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td>
      <td class="warning big">       <div class="progress progress-warning" style="width: 100px;">
        <div class="bar" style="width: 69.23%;"></div>
       </div>
</td>
      <td class="warning small"><div align="right">69.23%</div></td>
      <td class="warning small"><div align="right">9&nbsp;/&nbsp;13</div></td>
     </tr>

     <tr>
      <td class="danger">CodeCoverage</td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;2</div></td>
      <td class="danger small">4.47</td>
      <td class="warning big">       <div class="progress progress-warning" style="width: 100px;">
        <div class="bar" style="width: 69.23%;"></div>
       </div>
</td>
      <td class="warning small"><div align="right">69.23%</div></td>
      <td class="warning small"><div align="right">9&nbsp;/&nbsp;13</div></td>
     </tr>

     <tr>
      <td class="danger" colspan="4">&nbsp;<a href="#9">increment()</a></td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
      <td class="danger small">1.12</td>
      <td class="warning big">       <div class="progress progress-warning" style="width: 100px;">
        <div class="bar" style="width: 50.00%;"></div>
       </div>
</td>
      <td class="warning small"><div align="right">50.00%</div></td>
      <td class="warning small"><div align="right">1&nbsp;/&nbsp;2</div></td>
     </tr>

     <tr>
      <td class="danger" colspan="4">&nbsp;<a href="#16">switcher($int)</a></td>
      <td class="danger big">       <div class="progress progress-danger" style="width: 100px;">
        <div class="bar" style="width: 0.00%;"></div>
       </div>
</td>
      <td class="danger small"><div align="right">0.00%</div></td>
      <td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
      <td class="danger small">3.18</td>
      <td class="warning big">       <div class="progress progress-warning" style="width: 100px;">
        <div class="bar" style="width: 72.73%;"></div>
       </div>
</td>
      <td class="warning small"><div align="right">72.73%</div></td>
      <td class="warning small"><div align="right">8&nbsp;/&nbsp;11</div></td>
     </tr>


    </tbody>
   </table>
   <table class="table table-borderless table-condensed">
    <tbody>
     <tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><span class="default">&lt;?php</span></td></tr>
     <tr><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"></td></tr>
     <tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"><span class="keyword">namespace</span><span class="default">&nbsp;</span><span class="default">Feedback</span><span class="keyword">;</span></td></tr>
     <tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"></td></tr>
     <tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">CodeCoverage</span></td></tr>
     <tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
     <tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">protected</span><span class="default">&nbsp;</span><span class="default">$increment</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">;</span></td></tr>
     <tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"></td></tr>
     <tr><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">increment</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
     <tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
     <tr class="danger"><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">increment</span><span class="default">++</span><span class="keyword">;</span></td></tr>
     <tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"></td></tr>
     <tr class="success popin" data-title="1 test covers line 13" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testIncrement&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">increment</span><span class="keyword">;</span></td></tr>
     <tr><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
     <tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"></td></tr>
     <tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">switcher</span><span class="keyword">(</span><span class="default">$int</span><span class="keyword">)</span></td></tr>
     <tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
     <tr><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">switch</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$int</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 19" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">case</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">:</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 20" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$response</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">'number&nbsp;1'</span><span class="keyword">;</span></td></tr>
     <tr class="danger"><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 22" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">case</span><span class="default">&nbsp;</span><span class="default">2</span><span class="keyword">:</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 23" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$response</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">'number&nbsp;2'</span><span class="keyword">;</span></td></tr>
     <tr class="danger"><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 25" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">default</span><span class="keyword">:</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 26" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$response</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">'default'</span><span class="keyword">;</span></td></tr>
     <tr class="danger"><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span></td></tr>
     <tr class="success popin" data-title="1 test covers line 28" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
     <tr><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"></td></tr>
     <tr class="success popin" data-title="1 test covers line 30" data-content="&lt;ul&gt;&lt;li class=&quot;success&quot;&gt;FeedbackTest\CodeCoverageTest::testSwitcher&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$response</span><span class="keyword">;</span></td></tr>
     <tr><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>

    </tbody>
   </table>
   <footer>
    <h4>Legend</h4>
    <p>
     <span class="success"><strong>Executed</strong></span>
     <span class="danger"><strong>Not Executed</strong></span>
     <span class="warning"><strong>Dead Code</strong></span>
    </p>
    <p>
     <small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.13</a> using <a href="http://www.php.net/" target="_top">PHP 5.4.16</a> and <a href="http://phpunit.de/">PHPUnit 3.7.28</a> at Fri Oct 25 9:14:12 MDT 2013.</small>
    </p>
   </footer>
  </div>
  <script src="js/jquery.min.js" type="text/javascript"></script>
  <script src="js/bootstrap.min.js" type="text/javascript"></script>
  <script type="text/javascript">$('.popin').popover({trigger: 'hover'});</script>
 </body>
</html>
xdebugissue.zip (24,970 bytes)
Operating System
PHP Version5.4.10-5.4.14

Activities

jrhernandez84

2013-11-19 13:29

reporter   ~0002617

This is the exact bug I reported at http://bugs.xdebug.org/view.php?id=939 .

derick

2013-12-03 22:15

administrator   ~0002627

I can't reproduce this, it works just fine for me: http://derickrethans.nl/files/cov/BreakSample.php.html

I'm using PHP_CodeCoverage 1.2.13 using PHP 5.4.24-dev and PHPUnit 3.7.28 and Xdebug v2.2.4dev

Are you perhaps using an opcode cache, or another PHP version? Can you provide your phpinfo output in a text file?

Issue History

Date Modified Username Field Change
2013-10-25 15:23 chrislondon New Issue
2013-10-25 15:23 chrislondon File Added: Feedback_src_Feedback_CodeCoverage.php.html
2013-10-25 15:35 chrislondon File Added: xdebugissue.zip
2013-11-19 13:29 jrhernandez84 Note Added: 0002617
2013-12-03 22:15 derick Note Added: 0002627
2013-12-03 22:15 derick Assigned To => derick
2013-12-03 22:15 derick Status new => feedback
2014-03-05 09:17 derick Status feedback => resolved
2014-03-05 09:17 derick Resolution open => duplicate
2016-07-31 12:35 derick Category Debug client (console) => debugclient (debugging tool)
2016-07-31 12:35 derick Category debugclient (debugging tool) => (No Category)