Skip to content

Commit f0d3a08

Browse files
Fix skip conditions
1 parent 4fb37da commit f0d3a08

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tests/tests/Driver/XdebugDriverTest.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
use const PHP_SAPI;
1313
use function extension_loaded;
14-
use function ini_get;
15-
use function xdebug_code_coverage_started;
14+
use function in_array;
15+
use function phpversion;
16+
use function version_compare;
1617
use function xdebug_get_code_coverage;
18+
use function xdebug_info;
1719
use SebastianBergmann\CodeCoverage\Filter;
1820
use SebastianBergmann\CodeCoverage\TestCase;
1921

@@ -25,16 +27,12 @@ protected function setUp(): void
2527
$this->markTestSkipped('This test requires the PHP commandline interpreter');
2628
}
2729

28-
if (!extension_loaded('xdebug')) {
29-
$this->markTestSkipped('This test requires the Xdebug extension to be loaded');
30+
if (!extension_loaded('xdebug') || !version_compare(phpversion('xdebug'), '3.1', '>=')) {
31+
$this->markTestSkipped('This test requires the Xdebug extension (version >= 3.1) to be loaded');
3032
}
3133

32-
if (!ini_get('xdebug.mode') || ini_get('xdebug.mode') !== 'coverage') {
33-
$this->markTestSkipped('This test requires the Xdebug extension\'s code coverage functionality to be enabled');
34-
}
35-
36-
if (!xdebug_code_coverage_started()) {
37-
$this->markTestSkipped('This test requires code coverage data collection using Xdebug to be active');
34+
if (!in_array('coverage', xdebug_info('mode'), true)) {
35+
$this->markTestSkipped('This test requires code coverage data collection using Xdebug to be enabled');
3836
}
3937
}
4038

0 commit comments

Comments
 (0)