title: PHPUnit code coverage for abstract class at 0% even though it's clearly tested
body: <p>Writing a PHP package here, TDD with PhpUnit 4+.</p>
  
  <p>Writing tests for all my regular classes works fine, and they're covered in the report. But when I test the mock of an abstract class, even though the test clearly runs through the method (it fails if I fail to implement it, or if I put some breakpoints in there), the code coverage is 0%.</p>
  
  <p>I've extracted the offending code into a repo <a href="https://github.com/Swader/phpunit-oddity" rel="nofollow">here</a>, if you'd like to give it a whirl. All you need to do is clone, composer install, and run phpunit, it's all configured.</p>
  
  <p>This is being run on a Vagrant box, so an isolated environment that has nothing in particular to do with my PHP version or available extensions, and was tested by <a href="https://twitter.com/enygma/status/557203249141256192" rel="nofollow">other people</a>, too, on their installations, producing the same results.</p>
  
  <p>The abstract class being tested is <a href="https://github.com/Swader/phpunit-oddity/blob/master/src/abstracts/Api.php" rel="nofollow">here</a>, while its test can be seen <a href="https://github.com/Swader/phpunit-oddity/blob/master/tests/abstracts/ApiTest.php" rel="nofollow">here</a>.</p>
  
  <p>Any hints on what I may be doing wrong here would be greatly appreciated.</p>
  
  <p>Edit:</p>
  
  <p>Okay, so, as an added explanation, see comments on the accepted answer below, and Jordi's tweets <a href="https://twitter.com/seldaek/status/557228384577945600" rel="nofollow">here</a>. Basically, for perf reasons, Composer's autoloader just follows the case of the filesystem it's on, so it's best if one uses the same case on the folders as in the class names. If your namespace is uppercase, your folder should be, too. This still leaves open the question about why it actually managed to <em>read and run</em> the class' method, but didn't mark it as covered, so if you have any insight into that, please leave a comment or a more complete answer, and I'll re-accept that one.</p>
  
  <p>Edit 2:</p>
  
  <p>Additional sensible explanation by dstockto from IRC:</p>
  
  <blockquote>
    <p>I believe the issue is because when phpunit is collecting the code coverage information, it's in PHP arrays. The keys are case sensitive and so even though you have covered that, the coverage was for a differently cased file which PHPunit doesn't match up to the files that were loaded</p>
  </blockquote>