Skip to content

Commit 622835b

Browse files
Correct skip condition (either PCOV or (correctly configured) Xdebug are required)
1 parent eb09280 commit 622835b

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/end-to-end/regression/5218.phpt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,27 @@ https://github.com/sebastianbergmann/phpunit/issues/5218
44
pcov.directory=tests/end-to-end/regression/5218/src/
55
--SKIPIF--
66
<?php declare(strict_types=1);
7-
if (!extension_loaded('pcov')) {
8-
print "skip: this test requires pcov\n";
7+
if (extension_loaded('pcov')) {
8+
return;
9+
}
10+
11+
if (!extension_loaded('xdebug')) {
12+
print 'skip: This test requires a code coverage driver';
13+
}
14+
15+
if (version_compare(phpversion('xdebug'), '3.1', '>=') && in_array('coverage', xdebug_info('mode'), true)) {
16+
return;
17+
}
18+
19+
$mode = getenv('XDEBUG_MODE');
20+
21+
if ($mode === false || $mode === '') {
22+
$mode = ini_get('xdebug.mode');
23+
}
24+
25+
if ($mode === false ||
26+
!in_array('coverage', explode(',', $mode), true)) {
27+
print 'skip: XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set';
928
}
1029
--FILE--
1130
<?php declare(strict_types=1);

0 commit comments

Comments
 (0)