Skip to content

Commit

Permalink
Closes #834
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 27, 2020
1 parent 1119aa8 commit 0a7f0ac
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [9.2.4] - 2020-11-27

### Added

* [#834](https://github.com/sebastianbergmann/php-code-coverage/issues/834): Support `XDEBUG_MODE` environment variable

## [9.2.3] - 2020-10-30

### Changed
Expand Down Expand Up @@ -306,6 +312,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
* Update HTML report to Bootstrap 4

[9.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.3...9.2.4
[9.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.2...9.2.3
[9.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.1...9.2.2
[9.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.0...9.2.1
Expand Down
11 changes: 10 additions & 1 deletion src/Driver/Xdebug3Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
use const XDEBUG_CC_UNUSED;
use const XDEBUG_FILTER_CODE_COVERAGE;
use const XDEBUG_PATH_INCLUDE;
use function explode;
use function extension_loaded;
use function getenv;
use function in_array;
use function ini_get;
use function phpversion;
Expand Down Expand Up @@ -52,7 +54,14 @@ public function __construct(Filter $filter)
);
}

if (!ini_get('xdebug.mode') || !in_array('coverage', explode(',', ini_get('xdebug.mode')), true)) {
$mode = getenv('XDEBUG_MODE');

if ($mode === false) {
$mode = ini_get('xdebug.mode');
}

if ($mode === false ||
!in_array('coverage', explode(',', $mode), true)) {
throw new Xdebug3NotEnabledException;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Xdebug2NotEnabledException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ final class Xdebug2NotEnabledException extends RuntimeException implements Excep
{
public function __construct()
{
parent::__construct('xdebug.coverage_enable=On has to be set in php.ini');
parent::__construct('xdebug.coverage_enable=On has to be set');
}
}
2 changes: 1 addition & 1 deletion src/Exception/Xdebug3NotEnabledException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ final class Xdebug3NotEnabledException extends RuntimeException implements Excep
{
public function __construct()
{
parent::__construct('xdebug.mode=coverage has to be set in php.ini');
parent::__construct('XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set');
}
}
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class Version
public static function id(): string
{
if (self::$version === null) {
self::$version = (new VersionId('9.2.3', dirname(__DIR__)))->getVersion();
self::$version = (new VersionId('9.2.4', dirname(__DIR__)))->getVersion();
}

return self::$version;
Expand Down

0 comments on commit 0a7f0ac

Please sign in to comment.