Skip to content

Commit 7ee2ee7

Browse files
Closes #4376
1 parent eb334c8 commit 7ee2ee7

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

ChangeLog-9.2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 9.2 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [9.2.6] - 2020-MM-DD
6+
7+
### Fixed
8+
9+
* [#4376](https://github.com/sebastianbergmann/phpunit/issues/4376): Risky test that triggers an error is displayed incorrectly
10+
511
## [9.2.5] - 2020-06-22
612

713
### Fixed
@@ -50,6 +56,7 @@ All notable changes of the PHPUnit 9.2 release series are documented in this fil
5056
* [#4258](https://github.com/sebastianbergmann/phpunit/pull/4258): Prevent unpredictable result by raising an exception when multiple matchers can be applied to a test double invocation
5157
* The test runner no longer relies on `$_SERVER['REQUEST_TIME_FLOAT']` for printing the elapsed time
5258

59+
[9.2.6]: https://github.com/sebastianbergmann/phpunit/compare/9.2.5...9.2
5360
[9.2.5]: https://github.com/sebastianbergmann/phpunit/compare/9.2.4...9.2.5
5461
[9.2.4]: https://github.com/sebastianbergmann/phpunit/compare/9.2.3...9.2.4
5562
[9.2.3]: https://github.com/sebastianbergmann/phpunit/compare/9.2.2...9.2.3

src/Framework/TestResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ public function run(Test $test): void
776776
$risky = true;
777777
}
778778

779-
if ($this->forceCoversAnnotation && !$incomplete && !$skipped) {
779+
if ($this->forceCoversAnnotation && !$error && !$failure && !$warning && !$incomplete && !$skipped && !$risky) {
780780
$annotations = $test->getAnnotations();
781781

782782
if (!isset($annotations['class']['covers']) &&
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/4376
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][1] = '--configuration';
6+
$_SERVER['argv'][2] = __DIR__ . '/4376/';
7+
8+
require __DIR__ . '/../../../bootstrap.php';
9+
PHPUnit\TextUI\Command::main();
10+
--EXPECTF--
11+
PHPUnit %s by Sebastian Bergmann and contributors.
12+
13+
E 1 / 1 (100%)
14+
15+
Time: %s, Memory: %s
16+
17+
There was 1 error:
18+
19+
1) Test::testOne
20+
Error: Class 'C' not found
21+
22+
%sTest.php:%d
23+
24+
ERRORS!
25+
Tests: 1, Assertions: 0, Errors: 1.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
4+
forceCoversAnnotation="true">
5+
<testsuites>
6+
<testsuite name="default">
7+
<directory suffix="Test.php">tests</directory>
8+
</testsuite>
9+
</testsuites>
10+
</phpunit>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types=1);
2+
use PHPUnit\Framework\TestCase;
3+
4+
final class Test extends TestCase
5+
{
6+
public function testOne(): void
7+
{
8+
$o = new C;
9+
}
10+
}
11+

0 commit comments

Comments
 (0)