Skip to content

Commit bcbe040

Browse files
Make these checks more granular
1 parent 4ea7615 commit bcbe040

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

tests/tests/Driver/PcovDriverTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@
1313
use SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException;
1414
use SebastianBergmann\CodeCoverage\Filter;
1515
use SebastianBergmann\CodeCoverage\TestCase;
16-
use SebastianBergmann\Environment\Runtime;
1716

1817
final class PcovDriverTest extends TestCase
1918
{
2019
protected function setUp(): void
2120
{
22-
if (!(new Runtime)->hasPCOV()) {
23-
$this->markTestSkipped('This test is only applicable to PCOV');
21+
if (\PHP_SAPI !== 'cli') {
22+
$this->markTestSkipped('This test requires the PHP commandline interpreter');
23+
}
24+
25+
if (!\extension_loaded('pcov')) {
26+
$this->markTestSkipped('This test requires the PCOV extension to be loaded');
27+
}
28+
29+
if (!\ini_get('pcov.enabled')) {
30+
$this->markTestSkipped('This test requires the PCOV extension to be enabled');
2431
}
2532
}
2633

tests/tests/Driver/PhpdbgDriverTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
use SebastianBergmann\CodeCoverage\BranchAndPathCoverageNotSupportedException;
1313
use SebastianBergmann\CodeCoverage\DeadCodeDetectionNotSupportedException;
1414
use SebastianBergmann\CodeCoverage\TestCase;
15-
use SebastianBergmann\Environment\Runtime;
1615

1716
final class PhpdbgDriverTest extends TestCase
1817
{
1918
protected function setUp(): void
2019
{
21-
if (!(new Runtime)->hasPHPDBGCodeCoverage()) {
22-
$this->markTestSkipped('This test is only applicable to PHPDBG');
20+
if (\PHP_SAPI !== 'phpdbg') {
21+
$this->markTestSkipped('This test requires the PHPDBG commandline interpreter');
2322
}
2423
}
2524

tests/tests/Driver/XdebugDriverTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,25 @@
1111

1212
use SebastianBergmann\CodeCoverage\Filter;
1313
use SebastianBergmann\CodeCoverage\TestCase;
14-
use SebastianBergmann\Environment\Runtime;
1514

1615
final class XdebugDriverTest extends TestCase
1716
{
1817
protected function setUp(): void
1918
{
20-
if (!(new Runtime)->hasXdebug()) {
21-
$this->markTestSkipped('This test is only applicable to Xdebug');
19+
if (\PHP_SAPI !== 'cli') {
20+
$this->markTestSkipped('This test requires the PHP commandline interpreter');
21+
}
22+
23+
if (!\extension_loaded('xdebug')) {
24+
$this->markTestSkipped('This test requires the Xdebug extension to be loaded');
25+
}
26+
27+
if (!\ini_get('xdebug.coverage_enable')) {
28+
$this->markTestSkipped('This test requires the Xdebug extension\'s code coverage functionality to be enabled');
2229
}
2330

2431
if (!\xdebug_code_coverage_started()) {
25-
$this->markTestSkipped('This test requires code coverage using Xdebug to be running');
32+
$this->markTestSkipped('This test requires code coverage data collection using Xdebug to be active');
2633
}
2734
}
2835

0 commit comments

Comments
 (0)