Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code coverage only covering one test instead of all suite

I'm trying to get my code coverage report to cover all of my laravel application code ( Controllers and Models ). For some reason it is only covering one test. Is there something wrong with this configuration below?

<phpunit colors="true"
         bootstrap="/Users/bob/projects/leonardo2/laravel/cli/tasks/test/phpunit.php"
         backupGlobals="false">
  
  <testsuites>
    <testsuite name="Test Suite">
                        <directory suffix=".test.php">/Users/bob/projects/leonardo2/application/tests</directory>
                  </testsuite>
  </testsuites>
  
  <filter>
    <blacklist>       
        <exclude>
          <directory suffix=".test.php">/Users/bob/projects/leonardo2/application/tests</directory>
        </exclude>
    </blacklist>
    <whitelist>
      <exclude>
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/config</directory>       
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/views</directory>
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/migrations</directory>
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/libraries</directory>
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/tasks</directory>
        <directory suffix=".php">/Users/bob/projects/leonardo2/application/language</directory>
      </exclude>
    </whitelist>
  </filter>

   <logging>
      <log type="coverage-html" target="./storage/work/report/" charset="UTF-8"
       highlight="false" lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>
like image 983
user2108258 Avatar asked Dec 19 '13 12:12

user2108258


1 Answers

So much complex conditioning is not needed I guess. Just add the app directory in the whitelist under filter tag.

<filter>
    <whitelist>
        <directory suffix=".php">app/</directory>
    </whitelist>
</filter>

follow this link for a better understanding. Add Code Coverage Report to Laravel Project

like image 175
jishan Avatar answered Oct 30 '22 02:10

jishan