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

Upgrade xdebug-handler to v2 and handle that coverage option is set #1510

Merged
merged 2 commits into from Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -46,7 +46,7 @@
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"composer/xdebug-handler": "^1.3.3",
"composer/xdebug-handler": "^2.0",
"infection/abstract-testframework-adapter": "^0.3.1",
"infection/extension-installer": "^0.1.0",
"infection/include-interceptor": "^0.2.4",
Expand Down
17 changes: 9 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Console/XdebugHandler.php
Expand Up @@ -52,7 +52,7 @@ public static function check(LoggerInterface $logger): void
{
// We force the color option unconditionally since it is able to detect the --no-ansi option
// to disable it if necessary
Copy link
Member

Choose a reason for hiding this comment

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

is this comment still relevant since no --ansi argument is passed anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

(new ComposerXdebugHandler(self::PREFIX, '--ansi'))
(new ComposerXdebugHandler(self::PREFIX))
->setLogger($logger)
->setPersistent()
->check()
Expand Down
6 changes: 3 additions & 3 deletions src/TestFramework/Coverage/CoverageChecker.php
Expand Up @@ -101,9 +101,9 @@ public function checkCoverageRequirements(): void
if (!$this->skipCoverage && !$this->hasCoverageGeneratorEnabled()) {
throw new CoverageNotFound(<<<TXT
Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either:
- Enable pcov and run infection again
- Enable pcov and run Infection again
- Use phpdbg, e.g. `phpdbg -qrr infection`
- Enable Xdebug and run infection again
- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again
- Use the "--coverage" option with path to the existing coverage report
- Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so`
TXT
Expand Down Expand Up @@ -172,7 +172,7 @@ public function checkCoverageHasBeenGenerated(
private function hasCoverageGeneratorEnabled(): bool
{
return PHP_SAPI === 'phpdbg'
|| extension_loaded('xdebug')
|| XdebugHandler::isXdebugActive()
|| extension_loaded('pcov')
|| XdebugHandler::getSkippedVersion()
|| $this->isXdebugIncludedInInitialTestPhpOptions()
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/TestFramework/Coverage/CoverageCheckerTest.php
Expand Up @@ -140,9 +140,9 @@ public function test_it_needs_code_coverage_generator_enabled_if_coverage_is_not
$this->expectException(CoverageNotFound::class);
$this->expectExceptionMessage(<<<TXT
Coverage needs to be generated but no code coverage generator (pcov, phpdbg or xdebug) has been detected. Please either:
- Enable pcov and run infection again
- Enable pcov and run Infection again
- Use phpdbg, e.g. `phpdbg -qrr infection`
- Enable Xdebug and run infection again
- Enable Xdebug (in case of using Xdebug 3 check that `xdebug.mode` or environment variable XDEBUG_MODE set to `coverage`) and run Infection again
- Use the "--coverage" option with path to the existing coverage report
- Enable the code generator tool for the initial test run only, e.g. with `--initial-tests-php-options -d zend_extension=xdebug.so`
TXT
Expand Down