Laravel 5: PHPUnit and no code coverage driver available
<p>I would like to use PHPUnit to create code coverage reports. I have tried a lot of installation setups found on the web. But nothing seems to work out.</p>

<p>I use the latest version of Laravel 5 (>5.2) and PHPUnit v. 5.0.10. Further, I use MAMP on Mac OS X 10.9.5 running PHP 7. </p>

<p>When I run PHPUnit that is integrated in my Laravel distribution, I receive the following error.</p>

<pre><code>$ vendor/bin/phpunit -v
PHPUnit 5.0.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.0.0
Configuration: /Applications/MAMP/htdocs/myProject/phpunit.xml
Error:         No code coverage driver is available`
</code></pre>

<p>My composer file looks like:</p>

<pre><code>"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "5.0.*",
    "phpunit/php-code-coverage": "^3",
    "symfony/css-selector": "2.8.*|3.0.*",
    "symfony/dom-crawler": "2.8.*|3.0.*"
},
</code></pre>

<p>I have also tried the following command:</p>

<pre><code>/Applications/MAMP/bin/php/php7.0.0/bin/phpdbg -qrr ../../../htdocs/myProject/vendor/bin/phpunit -v
</code></pre>

<p>This seems to set up the code coverage driver well, but it ends up in an exception:</p>

<pre><code>$ /Applications/MAMP/bin/php/php7.0.0/bin/phpdbg -qrr ../../../htdocs/myProject/vendor/bin/phpunit -v
PHPUnit 5.0.10 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.0.0
Configuration: /Applications/MAMP/htdocs/myProject/phpunit.xml

[PHP Fatal error:  Uncaught ErrorException: include(/Applications/MAMP/htdocs/myProject/app/Exceptions/Handler.php): failed to open stream: Too many open files in /Applications/MAMP/htdocs/myProject/vendor/composer/ClassLoader.php:412
Stack trace:
...
</code></pre>

<p>The phpunit.xml looks as follows:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;phpunit backupGlobals="false"
     backupStaticAttributes="false"
     bootstrap="bootstrap/autoload.php"
     colors="true"
     convertErrorsToExceptions="true"
     convertNoticesToExceptions="true"
     convertWarningsToExceptions="true"
     processIsolation="false"
     stopOnFailure="false"&gt;
    &lt;testsuites&gt;
        &lt;testsuite name="Application Test Suite"&gt;
            &lt;directory&gt;./tests/&lt;/directory&gt;
        &lt;/testsuite&gt;
    &lt;/testsuites&gt;
    &lt;logging&gt;
      &lt;log type="coverage-html" target="./tests/codeCoverage" charset="UTF-8"/&gt;
    &lt;/logging&gt;
    &lt;filter&gt;
        &lt;whitelist&gt;
            &lt;directory suffix=".php"&gt;app/&lt;/directory&gt;
        &lt;/whitelist&gt;
    &lt;/filter&gt;
    &lt;php&gt;
        &lt;env name="APP_ENV" value="testing"/&gt;
        &lt;env name="CACHE_DRIVER" value="array"/&gt;
        &lt;env name="SESSION_DRIVER" value="array"/&gt;
        &lt;env name="QUEUE_DRIVER" value="sync"/&gt;
    &lt;/php&gt;
&lt;/phpunit&gt;
</code></pre>

<p>Is it possible to use PHPUnit that comes with the Laravel framework together with code coverage? How should I set it up and use it?</p>

<p>Thanks a lot for your help.</p>