I have PHP v7.0.15 PHPUnit v6.0.7. Running the command phpunit
alone runs all my tests just fine.
Now I'd like to get information on code coverage, so I made a directory called phpcoverage
and am running the command phpunit --coverage-html phpcoverage
. This outputs the error:
session_start(): Cannot send session cookie - headers already sent by (output started at phar:///usr/local/bin/phpunit/phpunit/Util/Printer.php:114)
I read in another answer that I should call @session_start()
in my tests, so I added that as the first line and now get the error:
A session had already been started - ignoring session_start()
My phpunit.xml file looks like this:
<phpunit bootstrap="public_html/app/vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true">
<testsuites>
<testsuite name="App Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">public_html/app/library</directory>
</whitelist>
</filter>
</phpunit>
Any help is appreciated.