Skip to content

Risky test that triggers an error is displayed incorrectly #4376

@sebastianbergmann

Description

@sebastianbergmann
$ tree          
.
├── phpunit.xml
└── tests
    └── Test.php

1 directory, 2 files

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.2/phpunit.xsd"
         forceCoversAnnotation="true"
         verbose="true">
    <testsuites>
        <testsuite name="default">
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>
</phpunit>

tests/Test.php

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class Test extends TestCase
{
    public function testOne(): void
    {
        $o = new C;
    }
}

Actual

PHPUnit 9.2.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.7
Configuration: /home/sb/bug/phpunit.xml

R                                                                   1 / 1 (100%)E

Time: 00:00.016, Memory: 4.00 MB

There was 1 error:

1) Test::testOne
Error: Class 'C' not found

/home/sb/bug/tests/Test.php:8

--

There was 1 risky test:

1) Test::testOne
This test does not have a @covers annotation but is expected to have one

ERRORS!
Tests: 1, Assertions: 0, Errors: 1, Risky: 1.

Expected

PHPUnit 9.2.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.7
Configuration: /home/sb/bug/phpunit.xml

E                                                                   1 / 1 (100%)

Time: 00:00.016, Memory: 4.00 MB

There was 1 error:

1) Test::testOne
Error: Class 'C' not found

/home/sb/bug/tests/Test.php:8

ERRORS!
Tests: 1, Assertions: 0, Errors: 1, Risky: 0.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions