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

Useless error message when depending on test that does not exist #3517

Closed
sebastianbergmann opened this issue Feb 7, 2019 · 3 comments
Closed
Labels
type/enhancement A new idea that should be implemented

Comments

@sebastianbergmann
Copy link
Owner

Reproducting example

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

final class Test extends TestCase
{
    /**
     * @depends doesNotExist
     */
    public function testOne(): void
    {
    }
}

Actual output

$ ./phpunit --verbose Test
PHPUnit 8.0.1 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.2 with Xdebug 2.7.0rc1

S                                                                   1 / 1 (100%)

Time: 30 ms, Memory: 4.00MB

There was 1 skipped test:

1) Test::testOne
This test depends on "Test::doesNotExist" to pass.

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.

Expected output

$ ./phpunit --verbose Test
PHPUnit 8.0.1 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.2 with Xdebug 2.7.0rc1

W                                                                   1 / 1 (100%)

Time: 30 ms, Memory: 4.00MB

There was 1 warning:

1) Test::testOne
This test depends on "Test::doesNotExist" which does not exist

WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Feb 7, 2019
@sebastianbergmann sebastianbergmann added this to the PHPUnit 8.1 milestone Feb 7, 2019
@sebastianbergmann
Copy link
Owner Author

@epdenouden Do you think that this can be implemented?

@epdenouden
Copy link
Contributor

epdenouden commented Feb 7, 2019

@sebastianbergmann Yes and I can build it if you'd like. I've recently done work in that area, it's just one extra check near the @depends handling. Bubbling a nice error to the surface might take a bit more work, I'll check it out.

@sebastianbergmann
Copy link
Owner Author

Would be great if you could implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants