Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risky test that triggers an error is displayed incorrectly #4376

Closed
sebastianbergmann opened this issue Jul 13, 2020 · 0 comments
Closed

Risky test that triggers an error is displayed incorrectly #4376

sebastianbergmann opened this issue Jul 13, 2020 · 0 comments
Assignees
Labels
feature/test-runner CLI test runner type/bug Something is broken

Comments

@sebastianbergmann
Copy link
Owner

$ 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.
@sebastianbergmann sebastianbergmann added type/bug Something is broken feature/test-runner CLI test runner labels Jul 13, 2020
@sebastianbergmann sebastianbergmann self-assigned this Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant