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

Add PCOV support #396

Closed
wants to merge 1 commit into from
Closed

Add PCOV support #396

wants to merge 1 commit into from

Conversation

@trejjam
Copy link
Contributor

trejjam commented Feb 2, 2019

  • new feature
  • BC break? no

Hello,

I met an announcement about PHPUnit 8 support PCOV which should be really fast in comparison to other code coverage possibilities, e.g. https://twitter.com/kornrunner/status/1091381371447230464, https://twitter.com/RemiCollet/status/1091336903423594496, etc.

This PR adds support for it.

@milo

This comment has been minimized.

Copy link
Member

milo commented Feb 8, 2019

@trejjam Great PR! But I have to check, why I get 0% coverage with it :)

@dg

This comment has been minimized.

Copy link
Member

dg commented Feb 8, 2019

You should write more tests :)

@trejjam

This comment has been minimized.

Copy link
Contributor Author

trejjam commented Feb 8, 2019

To make it work, I needed to configure application path in pcov.directory for my environment (probably because my test entrypoint is in different file subtree then application - which is out of scope in default/auto configuration)

@milo

This comment has been minimized.

Copy link
Member

milo commented Feb 19, 2019

The pcov.directory should be set to a common path of all --coverage-src values.

The pcov.directory is SYSTEM,PERDIR so must be set by -d pcov.directory=... from CliTester. Any idea how to do it nice and clean?

  1. Add PhpInterpreter::detectCodeCoverageEngine(): ?string and deprecate PhpInterpreter::canMeasureCodeCoverage()

  2. ?

@milo

This comment has been minimized.

Copy link
Member

milo commented Feb 19, 2019

With #400 there is easy to detect PCOV and set -d pcov.directory INI value.

@milo

This comment has been minimized.

Copy link
Member

milo commented Feb 19, 2019

Btw. if theoretically, all code coverage engines (PHPDBG, PCOV, Xdebug) are present, which one would you prefer?

Compare https://milovo.cz/static/tester-396/

@trejjam

This comment has been minimized.

Copy link
Contributor Author

trejjam commented Feb 20, 2019

I see more points of view:

  • prefer Xdebug - it can cover more edge cases - like method signature, and close brace (I feel it like more robust solution)
  • prefer PCOV - it is fast, lightweight, not requires Xdebug (for PHP 7.3 is still not stable)

I will prefer a fixed order of engines. For me is not important coverage value itself but changes of coverage through time. Using the same engine every time is good enough for me.

@milo milo force-pushed the nette:master branch 2 times, most recently from eaaeb7b to 7184606 Feb 21, 2019
@dg dg force-pushed the nette:master branch 2 times, most recently from ee525b7 to 6ca248e Feb 27, 2019
milo added a commit that referenced this pull request Mar 9, 2019
@milo

This comment has been minimized.

Copy link
Member

milo commented Mar 9, 2019

Merged, thank you!

The reasons for preferred code coverage engines are:

  1. PCOV - it is specialized extension for this purpose
  2. PHPDBG - when someone runs Tester with PHPDBG, I assume that a main purpose is code coverage
  3. Xdebug
@milo milo closed this Mar 9, 2019
milo added a commit that referenced this pull request Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.