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

Detect invalid phpunit @dataProvider #211

Open
staabm opened this issue Oct 3, 2024 · 2 comments
Open

Detect invalid phpunit @dataProvider #211

staabm opened this issue Oct 3, 2024 · 2 comments

Comments

@staabm
Copy link
Contributor

staabm commented Oct 3, 2024

Feature request

we should error about dataProvider annotations without a corresponding method

https://phpstan.org/r/9870d218-28c5-4636-88e9-85f73ce78bc9

Did PHPStan help you today? Did it make you happy in any way?

No response

@staabm staabm changed the title Detect invalid phpunit dataProvider Detect invalid phpunit @dataProvider Oct 3, 2024
@ondrejmirtes ondrejmirtes transferred this issue from phpstan/phpstan Oct 3, 2024
@ruudk
Copy link
Contributor

ruudk commented Oct 3, 2024

Why doesn't PHPUnit warn / error about this?

@staabm
Copy link
Contributor Author

staabm commented Oct 3, 2024

it does:

➜  phpstan-phpunit git:(2.0.x) ✗ vendor/bin/phpunit test.php
PHPUnit 9.6.16 by Sebastian Bergmann and contributors.

Warning:       No code coverage driver available

E                                                                   1 / 1 (100%)

Time: 00:00.002, Memory: 6.00 MB

There was 1 error:

1) Error
The data provider specified for test::testTrim is invalid.
PHPUnit\Util\Exception: Method test::wrongDataProvider() does not exist

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants