Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcov not reporting on ./tests directory #37

Closed
dmlogic opened this issue Nov 14, 2019 · 2 comments
Closed

pcov not reporting on ./tests directory #37

dmlogic opened this issue Nov 14, 2019 · 2 comments

Comments

@dmlogic
Copy link

dmlogic commented Nov 14, 2019

Not sure if this is the best place to ask but...

I'm looking to move my PHPUnit coverage reports to pcov from phpdbg to get around some issue with the latter not covering case statements.

When using xdebug or phpdbg I get 100% coverage on both my src and tests folders. When I use pcov I get 0% for tests.

My phpunit.xml file contains:

<filter>
    <whitelist  processUncoveredFilesFromWhitelist="false">
        <directory suffix=".php">src</directory>
        <directory suffix=".php">tests/Integration</directory>
        <directory suffix=".php">tests/Unit</directory>
    </whitelist>
</filter>
<logging>
    <log type="coverage-html" target="build/coverage"/>
</logging>

tests in all cases are run with ./vendor/bin/phpunit.

Am I missing something?

@krakjoe
Copy link
Owner

krakjoe commented Nov 14, 2019

You need to set pcov.directory (probably to the current working directory by the sound of it).

@krakjoe krakjoe closed this as completed Nov 14, 2019
@dmlogic
Copy link
Author

dmlogic commented Nov 15, 2019

yep. For anyone else, the solution for the above phpunit.xml is:

php -d extension=pcov.so -d pcov.enabled=1 -d pcov.directory=./ ./vendor/bin/phpunit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants