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

Preliminary support for PCOV #667

merged 3 commits into from Apr 15, 2019


Copy link

@sanmai sanmai commented Mar 15, 2019

This PR:

  • Add support for running Infection with PCOV (this is as easy as 1-2-3)

Fixes #665

I can verify that Infection can indeed recognize PCOV and do not fail with an error. Looks like this:

tests/Fixtures/e2e/PCOV_PHPUnit8$ php ../../../../bin/infection
You are running Infection with PCOV enabled.
     ____      ____          __  _
    /  _/___  / __/__  _____/ /_(_)___  ____
    / // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
  _/ // / / / __/  __/ /__/ /_/ / /_/ / / / /
 /___/_/ /_/_/  \___/\___/\__/_/\____/_/ /_/

Running initial test suite...
... and so on

Getting this new changes tested on CI is a bit tricky, because even though PCOV is kind of exclusive with xdebug, they both can be loaded at the same time, and it is not like PHPUnit is willing to report exactly what it is using for coverage. Extra care should be taken to be sure that PCOV does its thing, like by disabling and/or not installing xdebug in the first place. In Debian this is done by:

sudo phpdismod -v ALL xdebug
sudo phpenmod -v ALL pcov

PCOV is supported only under PHPUnit 8, which only works under PHP 7.2 and later, therefore if we wish to test Infection under PHP 7.1, we can't upgrade to PHPUnit 8 yet. There's an option of pcov/clobber, but that's kind of gross in my opinion. I'd rather have a single E2E test for PCOV for time being, than to resort to pcov/clobber with no clear benefit (and it is not our job to test PCOV).

@@ -188,6 +188,8 @@ private function logRunningWithDebugger(): void
} elseif (\extension_loaded('xdebug')) {
} elseif (\extension_loaded('pcov')) {
Copy link
Member Author

@sanmai sanmai Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure if we need this, but this may be a good idea in sake of verbosity.

maks-rafalko previously approved these changes Mar 29, 2019
Copy link

@maks-rafalko maks-rafalko left a comment

Does it need some more work (in progress label)?

Copy link
Member Author

sanmai commented Mar 30, 2019

Does it need some more work (in progress label)?

Yes, there isn't a test that would work properly on CI.

Copy link
Member Author

sanmai commented Apr 14, 2019

There's an E2E test one can run, but it is not used on CI yet. Hopefully we can add it later.

@maks-rafalko maks-rafalko added this to the 0.13.0 milestone Apr 15, 2019
Copy link

maks-rafalko commented Apr 15, 2019

Thank you @sanmai

@maks-rafalko maks-rafalko merged commit 46348d2 into infection:master Apr 15, 2019
2 of 3 checks passed
@sanmai sanmai deleted the pr/pcov-support branch Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

2 participants