Skip to content

Commit 72af6d9

Browse files
committed
Do not consider SkippedTest exceptions as errors for valid-fail tests
This is particularly relevant for kmsProviders tests, which may need to be skipped according to runOnRequirements.csfle
1 parent 866b325 commit 72af6d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ public function testFailingTests(UnifiedTestCase $test): void
248248
try {
249249
self::$runner->run($test);
250250
} catch (Exception $e) {
251+
// Respect skipped tests (e.g. evaluated runOnRequirements)
252+
if ($e instanceof SkippedTest) {
253+
throw $e;
254+
}
255+
251256
/* As is done in PHPUnit\Framework\TestCase::runBare(), exceptions
252257
* other than a select few will indicate a test failure. We cannot
253258
* call TestCase::hasFailed() because runBare() has yet to catch the
@@ -256,7 +261,7 @@ public function testFailingTests(UnifiedTestCase $test): void
256261
* IncompleteTest is intentionally omitted as it is thrown for an
257262
* incompatible schema. This differs from PHPUnit's internal logic.
258263
*/
259-
$failed = ! ($e instanceof SkippedTest || $e instanceof Warning);
264+
$failed = ! ($e instanceof Warning);
260265
}
261266

262267
// phpcs:enable

0 commit comments

Comments
 (0)