Skip to content

Commit d9c2332

Browse files
authored
Merge pull request #13 from KaririCode-Framework/develop
test(exceptions): remove #[CoversClass] from exception test to fix PH…
2 parents 21066a9 + 31f3b62 commit d9c2332

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/Unit/Exception/SanitizationExceptionsTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
use KaririCode\Sanitizer\Exception\InvalidRuleException;
88
use KaririCode\Sanitizer\Exception\SanitizationException;
9-
use PHPUnit\Framework\Attributes\CoversClass;
109
use PHPUnit\Framework\Attributes\Test;
1110
use PHPUnit\Framework\TestCase;
1211

13-
#[CoversClass(InvalidRuleException::class)]
14-
#[CoversClass(SanitizationException::class)]
12+
// NOTE: #[CoversClass] is intentionally omitted for exception classes.
13+
// In PHPUnit 12 + pcov, classes that directly extend \RuntimeException
14+
// (a native PHP class) are reported as "not a valid target for code coverage",
15+
// which triggers PHPUnit warnings that — with failOnWarning="true" — exit as code 1.
16+
// Coverage for these classes is achieved transitively via SanitizerEngineTest and others.
1517
final class SanitizationExceptionsTest extends TestCase
1618
{
1719
#[Test]

0 commit comments

Comments
 (0)