Skip to content

CodeCoverage: better support for Xdebug 3#424

Merged
dg merged 1 commit into
nette:masterfrom
jiripudil:xdebug-3
Dec 3, 2020
Merged

CodeCoverage: better support for Xdebug 3#424
dg merged 1 commit into
nette:masterfrom
jiripudil:xdebug-3

Conversation

@jiripudil
Copy link
Copy Markdown
Contributor

  • bug fix
  • BC break? no
  • doc PR: not necessary

Xdebug 3 requires xdebug.mode to include coverage for coverage to work, otherwise coverage-related symbols are not defined and tests fail with Error: Undefined constant "Tester\CodeCoverage\XDEBUG_CC_UNUSED".

Users can make it work by running tester with -d xdebug.mode=coverage, but I thought tester could setup this automatically, so that it works out of the box as with Xdebug 2. Therefore, this PR adds version number to code coverage engine info and uses that to automatically setup coverage mode for test processes when Xdebug >= 3.0.0 is used.

extension_loaded('xdebug') ? self::ENGINE_XDEBUG : null,
extension_loaded('pcov') ? [self::ENGINE_PCOV, phpversion('pcov')] : null,
defined('PHPDBG_VERSION') ? [self::ENGINE_PHPDBG, PHPDBG_VERSION] : null,
extension_loaded('xdebug') ? [self::ENGINE_XDEBUG, phpversion('xdebug')] : null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe [self::ENGINE_XDEBUG => phpversion('xdebug')]?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be harder to work with.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i thought it would be easier xd

@dg dg merged commit f01625a into nette:master Dec 3, 2020
dg pushed a commit that referenced this pull request Dec 3, 2020
@jiripudil jiripudil deleted the xdebug-3 branch December 3, 2020 11:29
dg pushed a commit that referenced this pull request Jan 31, 2021
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

Successfully merging this pull request may close these issues.

3 participants